UNPKG

@marinade.finance/kamino-sdk

Version:
314 lines 8.27 kB
"use strict"; 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 (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.layout = exports.fromJSON = exports.fromDecoded = exports.UpdateDisabled = exports.UpdateTwapMaxAge = exports.UpdatePriceMaxAge = exports.UpdateName = exports.UpdateScopeChain = exports.UpdateScopeTwap = exports.TwapDivergence = exports.ExpHeuristic = exports.UpperHeuristic = exports.LowerHeuristic = exports.CollateralId = void 0; const borsh = __importStar(require("@project-serum/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; // 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(); } throw new Error("Invalid enum object"); } exports.fromDecoded = fromDecoded; 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(); } } } exports.fromJSON = fromJSON; 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"), ]); if (property !== undefined) { return ret.replicate(property); } return ret; } exports.layout = layout; //# sourceMappingURL=UpdateCollateralInfoMode.js.map