@kamino-finance/scope-sdk
Version:
Scope Oracle SDK
372 lines • 10.1 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateMaxIgnorableAmountAsReward = exports.UpdateStakingRateChain = exports.UpdateDisabled = exports.UpdateTwapMaxAge = exports.UpdatePriceMaxAge = exports.UpdateName = exports.UpdateScopeChain = exports.UpdateScopeTwap = exports.TwapDivergence = exports.ExpHeuristic = exports.UpperHeuristic = exports.LowerHeuristic = exports.CollateralId = void 0;
exports.fromDecoded = fromDecoded;
exports.fromJSON = fromJSON;
exports.layout = layout;
const borsh = __importStar(require("@coral-xyz/borsh"));
class CollateralId {
static discriminator = 0;
static kind = "CollateralId";
discriminator = 0;
kind = "CollateralId";
toJSON() {
return {
kind: "CollateralId",
};
}
toEncodable() {
return {
CollateralId: {},
};
}
}
exports.CollateralId = CollateralId;
class LowerHeuristic {
static discriminator = 1;
static kind = "LowerHeuristic";
discriminator = 1;
kind = "LowerHeuristic";
toJSON() {
return {
kind: "LowerHeuristic",
};
}
toEncodable() {
return {
LowerHeuristic: {},
};
}
}
exports.LowerHeuristic = LowerHeuristic;
class UpperHeuristic {
static discriminator = 2;
static kind = "UpperHeuristic";
discriminator = 2;
kind = "UpperHeuristic";
toJSON() {
return {
kind: "UpperHeuristic",
};
}
toEncodable() {
return {
UpperHeuristic: {},
};
}
}
exports.UpperHeuristic = UpperHeuristic;
class ExpHeuristic {
static discriminator = 3;
static kind = "ExpHeuristic";
discriminator = 3;
kind = "ExpHeuristic";
toJSON() {
return {
kind: "ExpHeuristic",
};
}
toEncodable() {
return {
ExpHeuristic: {},
};
}
}
exports.ExpHeuristic = ExpHeuristic;
class TwapDivergence {
static discriminator = 4;
static kind = "TwapDivergence";
discriminator = 4;
kind = "TwapDivergence";
toJSON() {
return {
kind: "TwapDivergence",
};
}
toEncodable() {
return {
TwapDivergence: {},
};
}
}
exports.TwapDivergence = TwapDivergence;
class UpdateScopeTwap {
static discriminator = 5;
static kind = "UpdateScopeTwap";
discriminator = 5;
kind = "UpdateScopeTwap";
toJSON() {
return {
kind: "UpdateScopeTwap",
};
}
toEncodable() {
return {
UpdateScopeTwap: {},
};
}
}
exports.UpdateScopeTwap = UpdateScopeTwap;
class UpdateScopeChain {
static discriminator = 6;
static kind = "UpdateScopeChain";
discriminator = 6;
kind = "UpdateScopeChain";
toJSON() {
return {
kind: "UpdateScopeChain",
};
}
toEncodable() {
return {
UpdateScopeChain: {},
};
}
}
exports.UpdateScopeChain = UpdateScopeChain;
class UpdateName {
static discriminator = 7;
static kind = "UpdateName";
discriminator = 7;
kind = "UpdateName";
toJSON() {
return {
kind: "UpdateName",
};
}
toEncodable() {
return {
UpdateName: {},
};
}
}
exports.UpdateName = UpdateName;
class UpdatePriceMaxAge {
static discriminator = 8;
static kind = "UpdatePriceMaxAge";
discriminator = 8;
kind = "UpdatePriceMaxAge";
toJSON() {
return {
kind: "UpdatePriceMaxAge",
};
}
toEncodable() {
return {
UpdatePriceMaxAge: {},
};
}
}
exports.UpdatePriceMaxAge = UpdatePriceMaxAge;
class UpdateTwapMaxAge {
static discriminator = 9;
static kind = "UpdateTwapMaxAge";
discriminator = 9;
kind = "UpdateTwapMaxAge";
toJSON() {
return {
kind: "UpdateTwapMaxAge",
};
}
toEncodable() {
return {
UpdateTwapMaxAge: {},
};
}
}
exports.UpdateTwapMaxAge = UpdateTwapMaxAge;
class UpdateDisabled {
static discriminator = 10;
static kind = "UpdateDisabled";
discriminator = 10;
kind = "UpdateDisabled";
toJSON() {
return {
kind: "UpdateDisabled",
};
}
toEncodable() {
return {
UpdateDisabled: {},
};
}
}
exports.UpdateDisabled = UpdateDisabled;
class UpdateStakingRateChain {
static discriminator = 11;
static kind = "UpdateStakingRateChain";
discriminator = 11;
kind = "UpdateStakingRateChain";
toJSON() {
return {
kind: "UpdateStakingRateChain",
};
}
toEncodable() {
return {
UpdateStakingRateChain: {},
};
}
}
exports.UpdateStakingRateChain = UpdateStakingRateChain;
class UpdateMaxIgnorableAmountAsReward {
static discriminator = 12;
static kind = "UpdateMaxIgnorableAmountAsReward";
discriminator = 12;
kind = "UpdateMaxIgnorableAmountAsReward";
toJSON() {
return {
kind: "UpdateMaxIgnorableAmountAsReward",
};
}
toEncodable() {
return {
UpdateMaxIgnorableAmountAsReward: {},
};
}
}
exports.UpdateMaxIgnorableAmountAsReward = UpdateMaxIgnorableAmountAsReward;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function fromDecoded(obj) {
if (typeof obj !== "object") {
throw new Error("Invalid enum object");
}
if ("CollateralId" in obj) {
return new CollateralId();
}
if ("LowerHeuristic" in obj) {
return new LowerHeuristic();
}
if ("UpperHeuristic" in obj) {
return new UpperHeuristic();
}
if ("ExpHeuristic" in obj) {
return new ExpHeuristic();
}
if ("TwapDivergence" in obj) {
return new TwapDivergence();
}
if ("UpdateScopeTwap" in obj) {
return new UpdateScopeTwap();
}
if ("UpdateScopeChain" in obj) {
return new UpdateScopeChain();
}
if ("UpdateName" in obj) {
return new UpdateName();
}
if ("UpdatePriceMaxAge" in obj) {
return new UpdatePriceMaxAge();
}
if ("UpdateTwapMaxAge" in obj) {
return new UpdateTwapMaxAge();
}
if ("UpdateDisabled" in obj) {
return new UpdateDisabled();
}
if ("UpdateStakingRateChain" in obj) {
return new UpdateStakingRateChain();
}
if ("UpdateMaxIgnorableAmountAsReward" in obj) {
return new UpdateMaxIgnorableAmountAsReward();
}
throw new Error("Invalid enum object");
}
function fromJSON(obj) {
switch (obj.kind) {
case "CollateralId": {
return new CollateralId();
}
case "LowerHeuristic": {
return new LowerHeuristic();
}
case "UpperHeuristic": {
return new UpperHeuristic();
}
case "ExpHeuristic": {
return new ExpHeuristic();
}
case "TwapDivergence": {
return new TwapDivergence();
}
case "UpdateScopeTwap": {
return new UpdateScopeTwap();
}
case "UpdateScopeChain": {
return new UpdateScopeChain();
}
case "UpdateName": {
return new UpdateName();
}
case "UpdatePriceMaxAge": {
return new UpdatePriceMaxAge();
}
case "UpdateTwapMaxAge": {
return new UpdateTwapMaxAge();
}
case "UpdateDisabled": {
return new UpdateDisabled();
}
case "UpdateStakingRateChain": {
return new UpdateStakingRateChain();
}
case "UpdateMaxIgnorableAmountAsReward": {
return new UpdateMaxIgnorableAmountAsReward();
}
}
}
function layout(property) {
const ret = borsh.rustEnum([
borsh.struct([], "CollateralId"),
borsh.struct([], "LowerHeuristic"),
borsh.struct([], "UpperHeuristic"),
borsh.struct([], "ExpHeuristic"),
borsh.struct([], "TwapDivergence"),
borsh.struct([], "UpdateScopeTwap"),
borsh.struct([], "UpdateScopeChain"),
borsh.struct([], "UpdateName"),
borsh.struct([], "UpdatePriceMaxAge"),
borsh.struct([], "UpdateTwapMaxAge"),
borsh.struct([], "UpdateDisabled"),
borsh.struct([], "UpdateStakingRateChain"),
borsh.struct([], "UpdateMaxIgnorableAmountAsReward"),
]);
if (property !== undefined) {
return ret.replicate(property);
}
return ret;
}
//# sourceMappingURL=UpdateCollateralInfoMode.js.map
;