Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zetamarkets/flex-sdk

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zetamarkets/flex-sdk - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

5

CHANGELOG.md

@@ -8,2 +8,7 @@ # Changelog

## [0.2.3] - 2022-02-07
- flex: Return transaction signatures for client methods. ([#32](https://github.com/zetamarkets/zeta-flex/pull/32))
- flex: Remove get program address from flex object update state. ([#32](https://github.com/zetamarkets/zeta-flex/pull/32))
## [0.2.2] - 2022-02-07

@@ -10,0 +15,0 @@

1

dist/common/constants.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UNDERLYINGS_MAP = exports.SOL_PUBKEY = exports.PYTH_PRICE_FEEDS = void 0;
const web3_js_1 = require("@solana/web3.js");

@@ -4,0 +5,0 @@ exports.PYTH_PRICE_FEEDS = {

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.vaultIdlErrors = exports.flexIdlErrors = exports.parseIdlErrors = void 0;
const zeta_flex_json_1 = __importDefault(require("../idl/zeta_flex.json"));

@@ -8,0 +9,0 @@ const covered_call_vault_json_1 = __importDefault(require("../idl/covered_call_vault.json"));

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventType = void 0;
var EventType;

@@ -4,0 +5,0 @@ (function (EventType) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLUSTER_URLS = exports.Network = void 0;
var Network;

@@ -4,0 +5,0 @@ (function (Network) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Program = void 0;
var Program;

@@ -4,0 +5,0 @@ (function (Program) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DummyWallet = void 0;
class DummyWallet {

@@ -4,0 +5,0 @@ constructor() { }

40

dist/common/utils.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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;

@@ -13,2 +25,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.getUnderlyingMapping = exports.getTokenAccountsForMint = exports.createWrappedNativeAccount = exports.createAssociatedTokenAccountInstruction = exports.processTransaction = exports.getClockTimestamp = exports.readBigInt64LE = exports.boundsError = exports.validateNumber = exports.ERR_OUT_OF_RANGE = exports.ERR_INVALID_ARG_TYPE = exports.ERR_BUFFER_OUT_OF_BOUNDS = exports.getMintInfo = exports.getTokenAccountInfo = exports.getAssociatedTokenAddress = exports.defaultCommitment = exports.sleep = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -112,11 +125,14 @@ const web3_js_1 = require("@solana/web3.js");

// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L758
exports.ERR_BUFFER_OUT_OF_BOUNDS = () => new Error("Attempt to access memory outside buffer bounds");
const ERR_BUFFER_OUT_OF_BOUNDS = () => new Error("Attempt to access memory outside buffer bounds");
exports.ERR_BUFFER_OUT_OF_BOUNDS = ERR_BUFFER_OUT_OF_BOUNDS;
// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L968
exports.ERR_INVALID_ARG_TYPE = (name, expected, actual) => new Error(`The "${name}" argument must be of type ${expected}. Received ${actual}`);
const ERR_INVALID_ARG_TYPE = (name, expected, actual) => new Error(`The "${name}" argument must be of type ${expected}. Received ${actual}`);
exports.ERR_INVALID_ARG_TYPE = ERR_INVALID_ARG_TYPE;
// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/errors.js#L1262
exports.ERR_OUT_OF_RANGE = (str, range, received) => new Error(`The value of "${str} is out of range. It must be ${range}. Received ${received}`);
const ERR_OUT_OF_RANGE = (str, range, received) => new Error(`The value of "${str} is out of range. It must be ${range}. Received ${received}`);
exports.ERR_OUT_OF_RANGE = ERR_OUT_OF_RANGE;
// https://github.com/nodejs/node/blob/v14.17.0/lib/internal/validators.js#L127-L130
function validateNumber(value, name) {
if (typeof value !== "number")
throw exports.ERR_INVALID_ARG_TYPE(name, "number", value);
throw (0, exports.ERR_INVALID_ARG_TYPE)(name, "number", value);
}

@@ -128,7 +144,7 @@ exports.validateNumber = validateNumber;

validateNumber(value, "offset");
throw exports.ERR_OUT_OF_RANGE("offset", "an integer", value);
throw (0, exports.ERR_OUT_OF_RANGE)("offset", "an integer", value);
}
if (length < 0)
throw exports.ERR_BUFFER_OUT_OF_BOUNDS();
throw exports.ERR_OUT_OF_RANGE("offset", `>= 0 and <= ${length}`, value);
throw (0, exports.ERR_BUFFER_OUT_OF_BOUNDS)();
throw (0, exports.ERR_OUT_OF_RANGE)("offset", `>= 0 and <= ${length}`, value);
}

@@ -179,3 +195,3 @@ exports.boundsError = boundsError;

try {
let txSig = await web3_js_1.sendAndConfirmRawTransaction(provider.connection, tx.serialize(), opts || defaultCommitment());
let txSig = await (0, web3_js_1.sendAndConfirmRawTransaction)(provider.connection, tx.serialize(), opts || defaultCommitment());
return txSig;

@@ -271,3 +287,3 @@ }

{
dataSize: 165,
dataSize: 165, // number of bytes
},

@@ -277,3 +293,3 @@ {

offset: 0,
bytes: mint.toBase58(),
bytes: mint.toBase58(), // base58 encoded string
},

@@ -280,0 +296,0 @@ },

import * as anchor from "@project-serum/anchor";
import { ZetaFlex } from "../types/zeta_flex";
import { PublicKey, Connection } from "@solana/web3.js";
import { PublicKey, Connection, TransactionSignature } from "@solana/web3.js";
import { Position, Bid, TokenAcc } from "./types";

@@ -36,5 +36,5 @@ import { Wallet } from "../common/types";

static load(connection: Connection, wallet: Wallet, opts?: anchor.web3.ConfirmOptions): Promise<FlexClient>;
bidAuction(amount: number, auctionAccount: PublicKey): Promise<void>;
cancelBid(bidAccount: PublicKey): Promise<void>;
exerciseOption(optionAccount: PublicKey): Promise<void>;
bidAuction(amount: number, auctionAccount: PublicKey): Promise<TransactionSignature>;
cancelBid(bidAccount: PublicKey): Promise<TransactionSignature>;
exerciseOption(optionAccount: PublicKey): Promise<TransactionSignature>;
private updatePositions;

@@ -41,0 +41,0 @@ getExpiredPositions(): Position[];

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.FlexClient = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -111,3 +124,5 @@ const web3_js_1 = require("@solana/web3.js");

}
await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [keypair]);
return await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [
keypair,
]);
}

@@ -146,10 +161,5 @@ async cancelBid(bidAccount) {

}
try {
await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [
keypair,
]);
}
catch (e) {
throw e;
}
return await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [
keypair,
]);
}

@@ -197,11 +207,5 @@ else {

}
try {
await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [
keypair,
]);
}
catch (e) {
throw e;
}
let txSig = await utils.processTransaction(program_1.Program.FLEX, this._provider, tx, [keypair]);
await this.updateState();
return txSig;
}

@@ -208,0 +212,0 @@ async updatePositions() {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OPTION_DECIMAL_ADJUSTMENT = void 0;
exports.OPTION_DECIMAL_ADJUSTMENT = 5;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.getMinLotSize = exports.getOptionMintDecimals = exports.getUserOptionMintTokenAccountAddress = exports.getBidVaultAddress = exports.getBidAccountAddress = exports.getAuctionVaultAddress = exports.getAuctionAddress = exports.getVaultAddress = exports.getCreatorTokenAccountAddress = exports.getOptionMintAddress = exports.getOptionAccountAddress = exports.getUnderlyingAddress = exports.getVaultAuthorityAddress = exports.getMintAuthorityAddress = exports.getStateAddress = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -11,0 +24,0 @@ const web3_js_1 = require("@solana/web3.js");

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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;

@@ -13,2 +25,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.flex = exports.Flex = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -168,3 +181,3 @@ const zeta_flex_json_1 = __importDefault(require("../idl/zeta_flex.json"));

let underlying = this.getUnderlying(option.underlyingMint);
let tx = new web3_js_1.Transaction().add(instructions.expireOptionIx(option, underlying.oracle));
let tx = new web3_js_1.Transaction().add(instructions.expireOptionIx(option, underlying.address, underlying.oracle));
await utils.processTransaction(program_1.Program.FLEX, this._provider, tx);

@@ -196,6 +209,8 @@ }

this._options = await Promise.all(accs.map(async (acc) => {
let [flexVaultAddress, _nonce] = await flexUtils.getVaultAddress(this.programId, acc.publicKey);
let [underlying, _] = await flexUtils.getUnderlyingAddress(this.programId, acc.account.underlyingMint);
let flexVaultAddress = await web3_js_1.PublicKey.createProgramAddress([
Buffer.from(anchor.utils.bytes.utf8.encode("vault")),
acc.publicKey.toBuffer(),
Buffer.from([acc.account.vaultNonce]),
], this.programId);
return {
underlying,
optionAccount: acc.publicKey,

@@ -302,3 +317,11 @@ vault: flexVaultAddress,

let auctionAccount = acc.publicKey;
let [auctionVault, _] = await flexUtils.getAuctionVaultAddress(this.programId, acc.account.auctionTokenMint, acc.account.creator, acc.account.amount, acc.account.bidEnd, acc.account.cooldownEnd);
let auctionVault = await web3_js_1.PublicKey.createProgramAddress([
Buffer.from(anchor.utils.bytes.utf8.encode("auction-vault")),
acc.account.auctionTokenMint.toBuffer(),
acc.account.creator.toBuffer(),
acc.account.amount.toArrayLike(Buffer, "le", 8),
acc.account.bidEnd.toArrayLike(Buffer, "le", 8),
acc.account.cooldownEnd.toArrayLike(Buffer, "le", 8),
Buffer.from([acc.account.auctionVaultNonce]),
], this.programId);
let optionInfo = undefined;

@@ -305,0 +328,0 @@ for (let i = 0; i < this.options.length; i++) {

@@ -8,3 +8,3 @@ import { PublicKey, TransactionInstruction } from "@solana/web3.js";

export declare function expireOptionOverrideIx(overrideSettlementPrice: number, optionAccount: PublicKey): Promise<TransactionInstruction>;
export declare function expireOptionIx(option: flexTypes.Option, oracle: PublicKey): TransactionInstruction;
export declare function expireOptionIx(option: flexTypes.Option, underlying: PublicKey, oracle: PublicKey): TransactionInstruction;
export declare function exerciseOptionIx(vault: PublicKey, option: flexTypes.Option, userUnderlyingTokenAccount: PublicKey, userOptionTokenAccount: PublicKey, userKey: PublicKey): TransactionInstruction;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.exerciseOptionIx = exports.expireOptionIx = exports.expireOptionOverrideIx = exports.cancelBidIx = exports.bidAuctionIx = exports.initializeUnderlyingIx = exports.initializeStateIx = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -111,7 +124,7 @@ const flex_1 = require("./flex");

exports.expireOptionOverrideIx = expireOptionOverrideIx;
function expireOptionIx(option, oracle) {
function expireOptionIx(option, underlying, oracle) {
return flex_1.flex.program.instruction.expireOption({
accounts: {
state: flex_1.flex.stateAddress,
underlying: option.underlying,
underlying,
collateralMint: option.collateralMint,

@@ -118,0 +131,0 @@ optionAccount: option.optionAccount,

@@ -34,3 +34,2 @@ import { PublicKey } from "@solana/web3.js";

export interface Option {
underlying: PublicKey;
optionAccount: PublicKey;

@@ -37,0 +36,0 @@ vault: PublicKey;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toLocalSettlementType = exports.toProgramSettlementType = exports.SettlementType = exports.toLocalOracleMethod = exports.toProgramOracleMethod = exports.OracleMethod = exports.Version = exports.toLocalKind = exports.toProgramKind = exports.Kind = void 0;
var Kind;

@@ -4,0 +5,0 @@ (function (Kind) {

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.EventType = exports.utils = exports.Network = exports.types = exports.constants = exports.Program = exports.vaultData = exports.vaultDataTypes = exports.vaultEvents = exports.vaultTypes = exports.vaultProgramTypes = exports.vaultInstructions = exports.vaultUtils = exports.vaultConstants = exports.VaultClient = exports.Vault = exports.flexTypes = exports.flexProgramTypes = exports.flexConstants = exports.flexInstructions = exports.flexUtils = exports.FlexClient = exports.Flex = void 0;
const flex_1 = require("./flex/flex");
exports.Flex = flex_1.flex;
Object.defineProperty(exports, "Flex", { enumerable: true, get: function () { return flex_1.flex; } });
const client_1 = require("./flex/client");
exports.FlexClient = client_1.FlexClient;
Object.defineProperty(exports, "FlexClient", { enumerable: true, get: function () { return client_1.FlexClient; } });
const flexUtils = __importStar(require("./flex/flex-utils"));

@@ -25,3 +38,3 @@ exports.flexUtils = flexUtils;

const network_1 = require("./common/network");
exports.Network = network_1.Network;
Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_1.Network; } });
const types = __importStar(require("./common/types"));

@@ -34,9 +47,9 @@ exports.types = types;

const events_1 = require("./common/events");
exports.EventType = events_1.EventType;
Object.defineProperty(exports, "EventType", { enumerable: true, get: function () { return events_1.EventType; } });
const program_1 = require("./common/program");
exports.Program = program_1.Program;
Object.defineProperty(exports, "Program", { enumerable: true, get: function () { return program_1.Program; } });
const vault_1 = require("./vault/vault");
exports.Vault = vault_1.vault;
Object.defineProperty(exports, "Vault", { enumerable: true, get: function () { return vault_1.vault; } });
const client_2 = require("./vault/client");
exports.VaultClient = client_2.VaultClient;
Object.defineProperty(exports, "VaultClient", { enumerable: true, get: function () { return client_2.VaultClient; } });
const vaultConstants = __importStar(require("./vault/constants"));

@@ -43,0 +56,0 @@ exports.vaultConstants = vaultConstants;

export declare type ZetaFlex = {
"version": "0.0.0";
"name": "zeta_flex";
"instructions": [{
"name": "initializeState";
"accounts": [{
"name": "state";
"isMut": true;
"isSigner": false;
}, {
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "admin";
"isMut": true;
"isSigner": true;
}, {
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "args";
"instructions": [
{
"name": "initializeState";
"accounts": [
{
"name": "state";
"isMut": true;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "admin";
"isMut": true;
"isSigner": true;
},
{
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "args";
"type": {
"defined": "InitializeStateArgs";
};
}
];
},
{
"name": "initializeUnderlying";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "underlying";
"isMut": true;
"isSigner": false;
},
{
"name": "mint";
"isMut": false;
"isSigner": false;
},
{
"name": "oracle";
"isMut": false;
"isSigner": false;
},
{
"name": "admin";
"isMut": true;
"isSigner": true;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "args";
"type": {
"defined": "InitializeUnderlyingArgs";
};
}
];
},
{
"name": "initializeOption";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "underlying";
"isMut": true;
"isSigner": false;
},
{
"name": "vault";
"isMut": true;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "collateralMint";
"isMut": false;
"isSigner": false;
},
{
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "optionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": true;
"isSigner": false;
},
{
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "args";
"type": {
"defined": "InitializeOptionArgs";
};
}
];
},
{
"name": "burnOption";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "vault";
"isMut": true;
"isSigner": false;
},
{
"name": "collateralMint";
"isMut": false;
"isSigner": false;
},
{
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "optionAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": true;
"isSigner": false;
},
{
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "amount";
"type": "u64";
}
];
},
{
"name": "expireOptionOverride";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "underlying";
"isMut": true;
"isSigner": false;
},
{
"name": "collateralMint";
"isMut": false;
"isSigner": false;
},
{
"name": "optionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": false;
"isSigner": false;
},
{
"name": "vault";
"isMut": false;
"isSigner": false;
},
{
"name": "admin";
"isMut": false;
"isSigner": true;
}
];
"args": [
{
"name": "overridePrice";
"type": "u64";
}
];
},
{
"name": "expireOption";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "underlying";
"isMut": true;
"isSigner": false;
},
{
"name": "collateralMint";
"isMut": false;
"isSigner": false;
},
{
"name": "optionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "oracle";
"isMut": false;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": false;
"isSigner": false;
},
{
"name": "vault";
"isMut": false;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "exerciseOption";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "vault";
"isMut": true;
"isSigner": false;
},
{
"name": "collateralMint";
"isMut": false;
"isSigner": false;
},
{
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "authority";
"isMut": true;
"isSigner": true;
},
{
"name": "optionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": true;
"isSigner": false;
},
{
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": false;
}
];
"args": [];
},
{
"name": "collectRemainingCollateral";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "vault";
"isMut": true;
"isSigner": false;
},
{
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "optionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "optionMint";
"isMut": true;
"isSigner": false;
},
{
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "initializeAuction";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionVault";
"isMut": true;
"isSigner": false;
},
{
"name": "auctionTokenMint";
"isMut": false;
"isSigner": false;
},
{
"name": "creatorAuctionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creatorBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "bidCurrencyMint";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "args";
"type": {
"defined": "InitializeAuctionArgs";
};
}
];
},
{
"name": "cancelAuction";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionVault";
"isMut": true;
"isSigner": false;
},
{
"name": "auctionTokenMint";
"isMut": false;
"isSigner": false;
},
{
"name": "creatorAuctionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creatorBidCurrencyTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "bidAuction";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "bidder";
"isMut": true;
"isSigner": true;
},
{
"name": "bidAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "bidVault";
"isMut": true;
"isSigner": false;
},
{
"name": "bidCurrencyMint";
"isMut": false;
"isSigner": false;
},
{
"name": "bidderBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "bidderAuctionTokenAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "systemProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
},
{
"name": "rent";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "args";
"type": {
"defined": "BidAuctionArgs";
};
}
];
},
{
"name": "cancelBid";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionAccount";
"isMut": false;
"isSigner": false;
},
{
"name": "bidder";
"isMut": true;
"isSigner": true;
},
{
"name": "bidAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "bidVault";
"isMut": true;
"isSigner": false;
},
{
"name": "bidderBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [];
},
{
"name": "acceptBid";
"accounts": [
{
"name": "state";
"isMut": false;
"isSigner": false;
},
{
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "bidder";
"isMut": true;
"isSigner": false;
},
{
"name": "creator";
"isMut": true;
"isSigner": true;
},
{
"name": "bidAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
},
{
"name": "bidVault";
"isMut": true;
"isSigner": false;
},
{
"name": "auctionVault";
"isMut": true;
"isSigner": false;
},
{
"name": "bidderAuctionTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "creatorBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
},
{
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}
];
"args": [
{
"name": "expectedAmount";
"type": "u64";
}
];
}
];
"accounts": [
{
"name": "optionAccount";
"type": {
"defined": "InitializeStateArgs";
"kind": "struct";
"fields": [
{
"name": "version";
"type": {
"defined": "Version";
};
},
{
"name": "oracleMethod";
"type": {
"defined": "OracleMethod";
};
},
{
"name": "optionAccountNonce";
"type": "u8";
},
{
"name": "optionMintNonce";
"type": "u8";
},
{
"name": "creatorOptionTokenAccountNonce";
"type": "u8";
},
{
"name": "vaultNonce";
"type": "u8";
},
{
"name": "underlyingCount";
"type": "u64";
},
{
"name": "optionMint";
"type": "publicKey";
},
{
"name": "underlyingMint";
"type": "publicKey";
},
{
"name": "collateralMint";
"type": "publicKey";
},
{
"name": "exerciseMint";
"type": "publicKey";
},
{
"name": "creator";
"type": "publicKey";
},
{
"name": "collateralAmount";
"type": "u64";
},
{
"name": "creatorExerciseMintTokenAccount";
"type": "publicKey";
},
{
"name": "strike";
"type": "u64";
},
{
"name": "expiry";
"type": {
"defined": "Expiry";
};
},
{
"name": "kind";
"type": {
"defined": "Kind";
};
},
{
"name": "settlementType";
"type": {
"defined": "SettlementType";
};
},
{
"name": "settlementPrice";
"type": "u64";
},
{
"name": "profitPerOption";
"type": "u64";
},
{
"name": "remainingCollateral";
"type": "u64";
}
];
};
}];
}, {
"name": "initializeUnderlying";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
},
{
"name": "underlying";
"isMut": true;
"isSigner": false;
}, {
"name": "mint";
"isMut": false;
"isSigner": false;
}, {
"name": "oracle";
"isMut": false;
"isSigner": false;
}, {
"name": "admin";
"isMut": true;
"isSigner": true;
}, {
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "rent";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "args";
"type": {
"defined": "InitializeUnderlyingArgs";
"kind": "struct";
"fields": [
{
"name": "underlyingNonce";
"type": "u8";
},
{
"name": "mint";
"type": "publicKey";
},
{
"name": "oracle";
"type": "publicKey";
},
{
"name": "count";
"type": "u64";
}
];
};
}];
}, {
"name": "initializeOption";
"accounts": [{
},
{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "underlying";
"isMut": true;
"isSigner": false;
}, {
"name": "vault";
"isMut": true;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "collateralMint";
"isMut": false;
"isSigner": false;
}, {
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "optionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": true;
"isSigner": false;
}, {
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "rent";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "args";
"type": {
"defined": "InitializeOptionArgs";
"kind": "struct";
"fields": [
{
"name": "stateNonce";
"type": "u8";
},
{
"name": "mintAuthNonce";
"type": "u8";
},
{
"name": "vaultAuthNonce";
"type": "u8";
},
{
"name": "admin";
"type": "publicKey";
},
{
"name": "settlementPriceThresholdSeconds";
"type": "u32";
},
{
"name": "padding";
"type": {
"array": [
"u64",
32
];
};
}
];
};
}];
}, {
"name": "burnOption";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "vault";
"isMut": true;
"isSigner": false;
}, {
"name": "collateralMint";
"isMut": false;
"isSigner": false;
}, {
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "optionAccount";
"isMut": false;
"isSigner": false;
}, {
"name": "mintAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": true;
"isSigner": false;
}, {
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "amount";
"type": "u64";
}];
}, {
"name": "expireOptionOverride";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "underlying";
"isMut": true;
"isSigner": false;
}, {
"name": "collateralMint";
"isMut": false;
"isSigner": false;
}, {
"name": "optionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": false;
"isSigner": false;
}, {
"name": "vault";
"isMut": false;
"isSigner": false;
}, {
"name": "admin";
"isMut": false;
"isSigner": true;
}];
"args": [{
"name": "overridePrice";
"type": "u64";
}];
}, {
"name": "expireOption";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "underlying";
"isMut": true;
"isSigner": false;
}, {
"name": "collateralMint";
"isMut": false;
"isSigner": false;
}, {
"name": "optionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "oracle";
"isMut": false;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": false;
"isSigner": false;
}, {
"name": "vault";
"isMut": false;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}];
"args": [];
}, {
"name": "exerciseOption";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "vault";
"isMut": true;
"isSigner": false;
}, {
"name": "collateralMint";
"isMut": false;
"isSigner": false;
}, {
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "authority";
"isMut": true;
"isSigner": true;
}, {
"name": "optionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": true;
"isSigner": false;
}, {
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": false;
}];
"args": [];
}, {
"name": "collectRemainingCollateral";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "vault";
"isMut": true;
"isSigner": false;
}, {
"name": "collateralTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "optionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "optionMint";
"isMut": true;
"isSigner": false;
}, {
"name": "userOptionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}];
"args": [];
}, {
"name": "initializeAuction";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
},
{
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionVault";
"isMut": true;
"isSigner": false;
}, {
"name": "auctionTokenMint";
"isMut": false;
"isSigner": false;
}, {
"name": "creatorAuctionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creatorBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "bidCurrencyMint";
"isMut": false;
"isSigner": false;
}, {
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "rent";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "args";
"type": {
"defined": "InitializeAuctionArgs";
"kind": "struct";
"fields": [
{
"name": "auctionNonce";
"type": "u8";
},
{
"name": "auctionVaultNonce";
"type": "u8";
},
{
"name": "creator";
"type": "publicKey";
},
{
"name": "creatorBidCurrencyTokenAccount";
"type": "publicKey";
},
{
"name": "amount";
"type": "u64";
},
{
"name": "bidEnd";
"type": "u64";
},
{
"name": "cooldownEnd";
"type": "u64";
},
{
"name": "auctionTokenMint";
"type": "publicKey";
},
{
"name": "bidCurrencyMint";
"type": "publicKey";
},
{
"name": "exchangeAmount";
"type": "u64";
},
{
"name": "winningBidder";
"type": "publicKey";
}
];
};
}];
}, {
"name": "cancelAuction";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionVault";
"isMut": true;
"isSigner": false;
}, {
"name": "auctionTokenMint";
"isMut": false;
"isSigner": false;
}, {
"name": "creatorAuctionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creatorBidCurrencyTokenAccount";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}];
"args": [];
}, {
"name": "bidAuction";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionAccount";
"isMut": false;
"isSigner": false;
}, {
"name": "bidder";
"isMut": true;
"isSigner": true;
}, {
},
{
"name": "bidAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "bidVault";
"isMut": true;
"isSigner": false;
}, {
"name": "bidCurrencyMint";
"isMut": false;
"isSigner": false;
}, {
"name": "bidderBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "bidderAuctionTokenAccount";
"isMut": false;
"isSigner": false;
}, {
"name": "systemProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}, {
"name": "rent";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "args";
"type": {
"defined": "BidAuctionArgs";
"kind": "struct";
"fields": [
{
"name": "bidAccountNonce";
"type": "u8";
},
{
"name": "bidVaultNonce";
"type": "u8";
},
{
"name": "bidder";
"type": "publicKey";
},
{
"name": "amount";
"type": "u64";
},
{
"name": "bidEnd";
"type": "u64";
},
{
"name": "cooldownEnd";
"type": "u64";
},
{
"name": "auctionAccount";
"type": "publicKey";
},
{
"name": "bidVault";
"type": "publicKey";
},
{
"name": "bidderAuctionTokenAccount";
"type": "publicKey";
}
];
};
}];
}, {
"name": "cancelBid";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionAccount";
"isMut": false;
"isSigner": false;
}, {
"name": "bidder";
"isMut": true;
"isSigner": true;
}, {
"name": "bidAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "bidVault";
"isMut": true;
"isSigner": false;
}, {
"name": "bidderBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}];
"args": [];
}, {
"name": "acceptBid";
"accounts": [{
"name": "state";
"isMut": false;
"isSigner": false;
}, {
"name": "auctionAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "bidder";
"isMut": true;
"isSigner": false;
}, {
"name": "creator";
"isMut": true;
"isSigner": true;
}, {
"name": "bidAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "vaultAuthority";
"isMut": false;
"isSigner": false;
}, {
"name": "bidVault";
"isMut": true;
"isSigner": false;
}, {
"name": "auctionVault";
"isMut": true;
"isSigner": false;
}, {
"name": "bidderAuctionTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "creatorBidCurrencyTokenAccount";
"isMut": true;
"isSigner": false;
}, {
"name": "tokenProgram";
"isMut": false;
"isSigner": false;
}];
"args": [{
"name": "expectedAmount";
"type": "u64";
}];
}];
"accounts": [{
"name": "optionAccount";
"type": {
"kind": "struct";
"fields": [{
"name": "version";
"type": {
"defined": "Version";
};
}, {
"name": "oracleMethod";
"type": {
"defined": "OracleMethod";
};
}, {
"name": "optionAccountNonce";
"type": "u8";
}, {
"name": "optionMintNonce";
"type": "u8";
}, {
"name": "creatorOptionTokenAccountNonce";
"type": "u8";
}, {
"name": "vaultNonce";
"type": "u8";
}, {
"name": "underlyingCount";
"type": "u64";
}, {
"name": "optionMint";
"type": "publicKey";
}, {
"name": "underlyingMint";
"type": "publicKey";
}, {
"name": "collateralMint";
"type": "publicKey";
}, {
"name": "exerciseMint";
"type": "publicKey";
}, {
"name": "creator";
"type": "publicKey";
}, {
"name": "collateralAmount";
"type": "u64";
}, {
"name": "creatorExerciseMintTokenAccount";
"type": "publicKey";
}, {
"name": "strike";
"type": "u64";
}, {
"name": "expiry";
"type": {
"defined": "Expiry";
};
}, {
"name": "kind";
"type": {
"defined": "Kind";
};
}, {
"name": "settlementType";
"type": {
"defined": "SettlementType";
};
}, {
"name": "settlementPrice";
"type": "u64";
}, {
"name": "profitPerOption";
"type": "u64";
}, {
"name": "remainingCollateral";
"type": "u64";
}];
};
}, {
"name": "underlying";
"type": {
"kind": "struct";
"fields": [{
"name": "underlyingNonce";
"type": "u8";
}, {
"name": "mint";
"type": "publicKey";
}, {
"name": "oracle";
"type": "publicKey";
}, {
"name": "count";
"type": "u64";
}];
};
}, {
"name": "state";
"type": {
"kind": "struct";
"fields": [{
"name": "stateNonce";
"type": "u8";
}, {
"name": "mintAuthNonce";
"type": "u8";
}, {
"name": "vaultAuthNonce";
"type": "u8";
}, {
"name": "admin";
"type": "publicKey";
}, {
"name": "settlementPriceThresholdSeconds";
"type": "u32";
}, {
"name": "padding";
"type": {
"array": ["u64", 32];
};
}];
};
}, {
"name": "auctionAccount";
"type": {
"kind": "struct";
"fields": [{
"name": "auctionNonce";
"type": "u8";
}, {
"name": "auctionVaultNonce";
"type": "u8";
}, {
"name": "creator";
"type": "publicKey";
}, {
"name": "creatorBidCurrencyTokenAccount";
"type": "publicKey";
}, {
"name": "amount";
"type": "u64";
}, {
"name": "bidEnd";
"type": "u64";
}, {
"name": "cooldownEnd";
"type": "u64";
}, {
"name": "auctionTokenMint";
"type": "publicKey";
}, {
"name": "bidCurrencyMint";
"type": "publicKey";
}, {
"name": "exchangeAmount";
"type": "u64";
}, {
"name": "winningBidder";
"type": "publicKey";
}];
};
}, {
"name": "bidAccount";
"type": {
"kind": "struct";
"fields": [{
"name": "bidAccountNonce";
"type": "u8";
}, {
"name": "bidVaultNonce";
"type": "u8";
}, {
"name": "bidder";
"type": "publicKey";
}, {
"name": "amount";
"type": "u64";
}, {
"name": "bidEnd";
"type": "u64";
}, {
"name": "cooldownEnd";
"type": "u64";
}, {
"name": "auctionAccount";
"type": "publicKey";
}, {
"name": "bidVault";
"type": "publicKey";
}, {
"name": "bidderAuctionTokenAccount";
"type": "publicKey";
}];
};
}];
"types": [{
"name": "Expiry";
"type": {
"kind": "struct";
"fields": [{
"name": "settlementStart";
"type": "u64";
}, {
"name": "settlementEnd";
"type": "u64";
}];
};
}, {
"name": "InitializeOptionArgs";
"type": {
"kind": "struct";
"fields": [{
"name": "collateralAmount";
"type": "u64";
}, {
"name": "optionAccountNonce";
"type": "u8";
}, {
"name": "optionMintNonce";
"type": "u8";
}, {
"name": "tokenAccountNonce";
"type": "u8";
}, {
"name": "vaultNonce";
"type": "u8";
}, {
"name": "settlementStart";
"type": "u64";
}, {
"name": "settlementEnd";
"type": "u64";
}, {
"name": "strike";
"type": "u64";
}, {
"name": "kind";
"type": {
"defined": "Kind";
};
}, {
"name": "settlementType";
"type": {
"defined": "SettlementType";
};
}];
};
}, {
"name": "InitializeAuctionArgs";
"type": {
"kind": "struct";
"fields": [{
"name": "auctionNonce";
"type": "u8";
}, {
"name": "auctionVaultNonce";
"type": "u8";
}, {
"name": "amount";
"type": "u64";
}, {
"name": "bidEnd";
"type": "u64";
}, {
"name": "cooldownEnd";
"type": "u64";
}];
};
}, {
"name": "BidAuctionArgs";
"type": {
"kind": "struct";
"fields": [{
"name": "bidAccountNonce";
"type": "u8";
}, {
"name": "bidVaultNonce";
"type": "u8";
}, {
"name": "amount";
"type": "u64";
}];
};
}, {
"name": "InitializeStateArgs";
"type": {
"kind": "struct";
"fields": [{
"name": "stateNonce";
"type": "u8";
}, {
"name": "mintAuthNonce";
"type": "u8";
}, {
"name": "vaultAuthNonce";
"type": "u8";
}, {
"name": "settlementPriceThresholdSeconds";
"type": "u32";
}];
};
}, {
"name": "InitializeUnderlyingArgs";
"type": {
"kind": "struct";
"fields": [{
"name": "underlyingNonce";
"type": "u8";
}];
};
}, {
"name": "Version";
"type": {
"kind": "enum";
"variants": [{
"name": "V0";
}];
};
}, {
"name": "OracleMethod";
"type": {
"kind": "enum";
"variants": [{
"name": "SpotPrint";
}];
};
}, {
"name": "Kind";
"type": {
"kind": "enum";
"variants": [{
"name": "Undefined";
}, {
"name": "Call";
}, {
"name": "Put";
}];
};
}, {
"name": "SettlementType";
"type": {
"kind": "enum";
"variants": [{
"name": "Undefined";
}, {
"name": "Cash";
}];
};
}];
"errors": [{
"code": 300;
"name": "UnauthorizedAdmin";
"msg": "Unauthorized admin";
}, {
"code": 301;
"name": "TokenAccountMintMismatch";
"msg": "Token account mint mismatch";
}, {
"code": 302;
"name": "InvalidTokenAccountOwner";
"msg": "Invalid token account owner";
}, {
"code": 303;
"name": "InsufficientFunds";
"msg": "Insufficient funds";
}, {
"code": 304;
"name": "InsufficientOptionsToBurn";
"msg": "Insufficient options to burn";
}, {
"code": 305;
"name": "OnlyCreatorCanCloseOptionAccount";
"msg": "Only creator can close option account";
}, {
"code": 306;
"name": "OnlyCreatorCanBurnOptions";
"msg": "Only creator can burn options";
}, {
"code": 307;
"name": "OptionExpirationMustBeInTheFuture";
"msg": "Option expiration must be in the future";
}, {
"code": 308;
"name": "OptionHasNotExpiredYet";
"msg": "Option has not expired yet";
}, {
"code": 309;
"name": "OnlyAdminCanOverrideSettlementPrice";
"msg": "Only admin can override settlement price";
}, {
"code": 310;
"name": "BeforeSetSettlementPriceTime";
"msg": "Before set settlement price time";
}, {
"code": 311;
"name": "AfterSetSettlementPriceTime";
"msg": "After set settlement price time";
}, {
"code": 312;
"name": "SettlementPriceAlreadySet";
"msg": "Settlement price already set";
}, {
"code": 313;
"name": "SettlementPriceNotSet";
"msg": "SettlementPriceNotSet";
}, {
"code": 314;
"name": "InvalidOracle";
"msg": "InvalidOracle";
}, {
"code": 315;
"name": "InvalidSettlementOptionMint";
"msg": "Invalid settlment option mint";
}, {
"code": 316;
"name": "CannotBurnOptionsAfterExpiry";
"msg": "Cannot burn options after expiry";
}, {
"code": 317;
"name": "CannotBurnOptionsAfterSettlementPriceIsSet";
"msg": "Cannot burn options after settlement price is set";
}, {
"code": 318;
"name": "OwnerMismatch";
"msg": "Owner mismatch";
}, {
"code": 319;
"name": "OptionMintMismatch";
"msg": "Option mint mismatch";
}, {
"code": 320;
"name": "AuctionCooldownEndHasToBeAfterBidEnd";
"msg": "Auction cooldown end has to be after bid end";
}, {
"code": 321;
"name": "AuctionBidEndHasToBeInTheFuture";
"msg": "Auction bid end has to be in the future";
}, {
"code": 322;
"name": "OnlyCreatorCanCancelAuction";
"msg": "Only creator can cancel auction";
}, {
"code": 323;
"name": "CannotCancelAuctionAfterCompletion";
"msg": "Cannot cancel auction after completion";
}, {
"code": 324;
"name": "CannotBidAfterBidEnd";
"msg": "Cannot bid after bid end";
}, {
"code": 325;
"name": "OnlyBidderCanCancelBid";
"msg": "Only bidder can cancel bid";
}, {
"code": 326;
"name": "BidCurrencyMintMismatch";
"msg": "BidCurrencyMintMismatch";
}, {
"code": 327;
"name": "CannotCancelBidDuringCooldownPeriod";
"msg": "Cannot cancel bid during cooldown period";
}, {
"code": 328;
"name": "ExpectedAmountMismatch";
"msg": "ExpectedAmountMismatch";
}, {
"code": 329;
"name": "CannotAcceptBidOutsideOfCooldownPeriod";
"msg": "Cannot accept bid outside of cooldown period";
}, {
"code": 330;
"name": "InvalidBidderAuctionTokenAccount";
"msg": "Invalid bidder auction token account";
}, {
"code": 331;
"name": "InvalidCreatorBidCurrencyTokenAccount";
"msg": "Invalid creator bid currency token account";
}, {
"code": 332;
"name": "CreatorNativeTokenAccountShouldBeEmpty";
"msg": "Creator native token account should be empty";
}, {
"code": 333;
"name": "NativeTokenAuctionUnsupported";
"msg": "Native token auction unsupported";
}, {
"code": 334;
"name": "CancelBidNativeTokenAccountShouldBeEmpty";
"msg": "Cancel bid native token account should be empty";
}, {
"code": 335;
"name": "CollateralAmountNotAFactorOfMinLotSize";
"msg": "Collateral amount not a factor of min lot size";
}, {
"code": 336;
"name": "CannotInitializeOptionWithZeroCollateral";
"msg": "Cannot initialize option with zero collateral";
}, {
"code": 337;
"name": "CannotInitializeAuctionWithZeroAmount";
"msg": "Cannot initialize auction with zero amount";
}, {
"code": 338;
"name": "InvalidOptionKind";
"msg": "Invalid option kind";
}, {
"code": 339;
"name": "CallCollateralMintMustMatchUnderlyingMint";
"msg": "Call collateral mint must match underlying mint";
}, {
"code": 340;
"name": "InvalidUsdMint";
"msg": "Invalid usd mint";
}, {
"code": 341;
"name": "InvalidUnderlyingMint";
"msg": "Invalid underlying mint";
}, {
"code": 342;
"name": "InvalidCollateralMint";
"msg": "Invalid collateral mint";
}, {
"code": 343;
"name": "InvalidCreator";
"msg": "Invalid creator";
}];
}
];
"types": [
{
"name": "Expiry";
"type": {
"kind": "struct";
"fields": [
{
"name": "settlementStart";
"type": "u64";
},
{
"name": "settlementEnd";
"type": "u64";
}
];
};
},
{
"name": "InitializeOptionArgs";
"type": {
"kind": "struct";
"fields": [
{
"name": "collateralAmount";
"type": "u64";
},
{
"name": "optionAccountNonce";
"type": "u8";
},
{
"name": "optionMintNonce";
"type": "u8";
},
{
"name": "tokenAccountNonce";
"type": "u8";
},
{
"name": "vaultNonce";
"type": "u8";
},
{
"name": "settlementStart";
"type": "u64";
},
{
"name": "settlementEnd";
"type": "u64";
},
{
"name": "strike";
"type": "u64";
},
{
"name": "kind";
"type": {
"defined": "Kind";
};
},
{
"name": "settlementType";
"type": {
"defined": "SettlementType";
};
}
];
};
},
{
"name": "InitializeAuctionArgs";
"type": {
"kind": "struct";
"fields": [
{
"name": "auctionNonce";
"type": "u8";
},
{
"name": "auctionVaultNonce";
"type": "u8";
},
{
"name": "amount";
"type": "u64";
},
{
"name": "bidEnd";
"type": "u64";
},
{
"name": "cooldownEnd";
"type": "u64";
}
];
};
},
{
"name": "BidAuctionArgs";
"type": {
"kind": "struct";
"fields": [
{
"name": "bidAccountNonce";
"type": "u8";
},
{
"name": "bidVaultNonce";
"type": "u8";
},
{
"name": "amount";
"type": "u64";
}
];
};
},
{
"name": "InitializeStateArgs";
"type": {
"kind": "struct";
"fields": [
{
"name": "stateNonce";
"type": "u8";
},
{
"name": "mintAuthNonce";
"type": "u8";
},
{
"name": "vaultAuthNonce";
"type": "u8";
},
{
"name": "settlementPriceThresholdSeconds";
"type": "u32";
}
];
};
},
{
"name": "InitializeUnderlyingArgs";
"type": {
"kind": "struct";
"fields": [
{
"name": "underlyingNonce";
"type": "u8";
}
];
};
},
{
"name": "Version";
"type": {
"kind": "enum";
"variants": [
{
"name": "V0";
}
];
};
},
{
"name": "OracleMethod";
"type": {
"kind": "enum";
"variants": [
{
"name": "SpotPrint";
}
];
};
},
{
"name": "Kind";
"type": {
"kind": "enum";
"variants": [
{
"name": "Undefined";
},
{
"name": "Call";
},
{
"name": "Put";
}
];
};
},
{
"name": "SettlementType";
"type": {
"kind": "enum";
"variants": [
{
"name": "Undefined";
},
{
"name": "Cash";
}
];
};
}
];
"errors": [
{
"code": 300;
"name": "UnauthorizedAdmin";
"msg": "Unauthorized admin";
},
{
"code": 301;
"name": "TokenAccountMintMismatch";
"msg": "Token account mint mismatch";
},
{
"code": 302;
"name": "InvalidTokenAccountOwner";
"msg": "Invalid token account owner";
},
{
"code": 303;
"name": "InsufficientFunds";
"msg": "Insufficient funds";
},
{
"code": 304;
"name": "InsufficientOptionsToBurn";
"msg": "Insufficient options to burn";
},
{
"code": 305;
"name": "OnlyCreatorCanCloseOptionAccount";
"msg": "Only creator can close option account";
},
{
"code": 306;
"name": "OnlyCreatorCanBurnOptions";
"msg": "Only creator can burn options";
},
{
"code": 307;
"name": "OptionExpirationMustBeInTheFuture";
"msg": "Option expiration must be in the future";
},
{
"code": 308;
"name": "OptionHasNotExpiredYet";
"msg": "Option has not expired yet";
},
{
"code": 309;
"name": "OnlyAdminCanOverrideSettlementPrice";
"msg": "Only admin can override settlement price";
},
{
"code": 310;
"name": "BeforeSetSettlementPriceTime";
"msg": "Before set settlement price time";
},
{
"code": 311;
"name": "AfterSetSettlementPriceTime";
"msg": "After set settlement price time";
},
{
"code": 312;
"name": "SettlementPriceAlreadySet";
"msg": "Settlement price already set";
},
{
"code": 313;
"name": "SettlementPriceNotSet";
"msg": "SettlementPriceNotSet";
},
{
"code": 314;
"name": "InvalidOracle";
"msg": "InvalidOracle";
},
{
"code": 315;
"name": "InvalidSettlementOptionMint";
"msg": "Invalid settlment option mint";
},
{
"code": 316;
"name": "CannotBurnOptionsAfterExpiry";
"msg": "Cannot burn options after expiry";
},
{
"code": 317;
"name": "CannotBurnOptionsAfterSettlementPriceIsSet";
"msg": "Cannot burn options after settlement price is set";
},
{
"code": 318;
"name": "OwnerMismatch";
"msg": "Owner mismatch";
},
{
"code": 319;
"name": "OptionMintMismatch";
"msg": "Option mint mismatch";
},
{
"code": 320;
"name": "AuctionCooldownEndHasToBeAfterBidEnd";
"msg": "Auction cooldown end has to be after bid end";
},
{
"code": 321;
"name": "AuctionBidEndHasToBeInTheFuture";
"msg": "Auction bid end has to be in the future";
},
{
"code": 322;
"name": "OnlyCreatorCanCancelAuction";
"msg": "Only creator can cancel auction";
},
{
"code": 323;
"name": "CannotCancelAuctionAfterCompletion";
"msg": "Cannot cancel auction after completion";
},
{
"code": 324;
"name": "CannotBidAfterBidEnd";
"msg": "Cannot bid after bid end";
},
{
"code": 325;
"name": "OnlyBidderCanCancelBid";
"msg": "Only bidder can cancel bid";
},
{
"code": 326;
"name": "BidCurrencyMintMismatch";
"msg": "BidCurrencyMintMismatch";
},
{
"code": 327;
"name": "CannotCancelBidDuringCooldownPeriod";
"msg": "Cannot cancel bid during cooldown period";
},
{
"code": 328;
"name": "ExpectedAmountMismatch";
"msg": "ExpectedAmountMismatch";
},
{
"code": 329;
"name": "CannotAcceptBidOutsideOfCooldownPeriod";
"msg": "Cannot accept bid outside of cooldown period";
},
{
"code": 330;
"name": "InvalidBidderAuctionTokenAccount";
"msg": "Invalid bidder auction token account";
},
{
"code": 331;
"name": "InvalidCreatorBidCurrencyTokenAccount";
"msg": "Invalid creator bid currency token account";
},
{
"code": 332;
"name": "CreatorNativeTokenAccountShouldBeEmpty";
"msg": "Creator native token account should be empty";
},
{
"code": 333;
"name": "NativeTokenAuctionUnsupported";
"msg": "Native token auction unsupported";
},
{
"code": 334;
"name": "CancelBidNativeTokenAccountShouldBeEmpty";
"msg": "Cancel bid native token account should be empty";
},
{
"code": 335;
"name": "CollateralAmountNotAFactorOfMinLotSize";
"msg": "Collateral amount not a factor of min lot size";
},
{
"code": 336;
"name": "CannotInitializeOptionWithZeroCollateral";
"msg": "Cannot initialize option with zero collateral";
},
{
"code": 337;
"name": "CannotInitializeAuctionWithZeroAmount";
"msg": "Cannot initialize auction with zero amount";
},
{
"code": 338;
"name": "InvalidOptionKind";
"msg": "Invalid option kind";
},
{
"code": 339;
"name": "CallCollateralMintMustMatchUnderlyingMint";
"msg": "Call collateral mint must match underlying mint";
},
{
"code": 340;
"name": "InvalidUsdMint";
"msg": "Invalid usd mint";
},
{
"code": 341;
"name": "InvalidUnderlyingMint";
"msg": "Invalid underlying mint";
},
{
"code": 342;
"name": "InvalidCollateralMint";
"msg": "Invalid collateral mint";
},
{
"code": 343;
"name": "InvalidCreator";
"msg": "Invalid creator";
}
];
};
export declare const IDL: ZetaFlex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDL = void 0;
exports.IDL = {

@@ -4,0 +5,0 @@ "version": "0.0.0",

import * as anchor from "@project-serum/anchor";
import { CoveredCallVault } from "../types/covered_call_vault";
import { PublicKey, Connection } from "@solana/web3.js";
import { PublicKey, Connection, TransactionSignature } from "@solana/web3.js";
import { Wallet } from "../common/types";

@@ -27,10 +27,10 @@ import { QueueNode, QueuedNodes, VaultTokens } from "./types";

static load(connection: Connection, wallet: Wallet, opts?: anchor.web3.ConfirmOptions): Promise<VaultClient>;
depositVault(vault: PublicKey, amount: anchor.BN): Promise<void>;
removeQueuedDeposit(vault: PublicKey, queueNodeToRemove: PublicKey): Promise<void>;
removeQueuedWithdrawal(vault: PublicKey, queueNodeToRemove: PublicKey): Promise<void>;
depositVault(vault: PublicKey, amount: anchor.BN): Promise<TransactionSignature>;
removeQueuedDeposit(vault: PublicKey, queueNodeToRemove: PublicKey): Promise<TransactionSignature>;
removeQueuedWithdrawal(vault: PublicKey, queueNodeToRemove: PublicKey): Promise<TransactionSignature>;
getQueuedDeposits(vault: PublicKey): QueueNode[];
getQueuedWithdrawals(vault: PublicKey): QueueNode[];
withdrawVault(vault: PublicKey, amount: anchor.BN): Promise<void>;
withdrawVault(vault: PublicKey, amount: anchor.BN): Promise<TransactionSignature>;
updateState(): Promise<void>;
getRedeemableTokenAmount(vault: PublicKey): number;
}
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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;

@@ -13,2 +25,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.VaultClient = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -93,5 +106,3 @@ const covered_call_vault_json_1 = __importDefault(require("../idl/covered_call_vault.json"));

let prevRedeemableBalance = this.getRedeemableTokenAmount(vaultInfo.address);
await utils.processTransaction(program_1.Program.VAULT, this._provider, tx, [
keypair,
]);
let txSig = await utils.processTransaction(program_1.Program.VAULT, this._provider, tx, [keypair]);
await this.updateState();

@@ -105,2 +116,3 @@ let diff = this.getRedeemableTokenAmount(vaultInfo.address) - prevRedeemableBalance;

}
return txSig;
}

@@ -149,3 +161,3 @@ async removeQueuedDeposit(vault, queueNodeToRemove) {

tx.add(instructions.removeQueuedDepositIx(this.publicKey, underlyingTokenAccountAddress, vaultInfo, currNodeAddress, remainingAccounts));
await utils.processTransaction(program_1.Program.VAULT, this._provider, tx);
return await utils.processTransaction(program_1.Program.VAULT, this._provider, tx);
}

@@ -194,3 +206,3 @@ async removeQueuedWithdrawal(vault, queueNodeToRemove) {

tx.add(instructions.removeQueuedWithdrawIx(this.publicKey, redeemableTokenAccountAddress, vaultInfo, currNodeAddress, remainingAccounts));
await utils.processTransaction(program_1.Program.VAULT, this._provider, tx);
return await utils.processTransaction(program_1.Program.VAULT, this._provider, tx);
}

@@ -246,7 +258,6 @@ getQueuedDeposits(vault) {

tx.add(await instructions.withdrawVaultIx(this.publicKey, amount, underlyingTokenAccountAddress, redeemableTokenAccountAddress, vault));
await utils.processTransaction(program_1.Program.VAULT, this._provider, tx, [
keypair,
]);
let txSig = await utils.processTransaction(program_1.Program.VAULT, this._provider, tx, [keypair]);
await this.updateState();
console.log(`Withdrawal successful`);
return txSig;
}

@@ -253,0 +264,0 @@ async updateState() {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PROCESS_QUEUE_ACCOUNT_LIMIT = void 0;
exports.PROCESS_QUEUE_ACCOUNT_LIMIT = 7;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.getVaultAuctionData = exports.getVaultData = void 0;
const flex_1 = require("../flex/flex");

@@ -11,0 +24,0 @@ const vault_1 = require("./vault");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VaultEvent = void 0;
var VaultEvent;

@@ -4,0 +5,0 @@ (function (VaultEvent) {

@@ -13,3 +13,3 @@ import * as anchor from "@project-serum/anchor";

export declare function removeQueuedDepositIx(userKey: PublicKey, userUnderlyingTokenAccount: PublicKey, vaultInfo: vaultTypes.Vault, queueNodeToRemove: PublicKey, remainingAccounts: AccountMeta[]): TransactionInstruction;
export declare function initializeOptionIx(vault: PublicKey, strike: anchor.BN): Promise<any>;
export declare function initializeOptionIx(vault: PublicKey, strike: anchor.BN): Promise<anchor.web3.TransactionInstruction>;
export declare function initializeAuctionIx(vault: PublicKey, auctionAmount: anchor.BN, optionMint: PublicKey, bidEnd: anchor.BN, cooldownEnd: anchor.BN): Promise<TransactionInstruction>;

@@ -16,0 +16,0 @@ export declare function cancelAuctionIx(vault: PublicKey, auction: flexTypes.Auction): TransactionInstruction;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.overrideVaultEpochTimesIx = exports.removeQueuedWithdrawIx = exports.processWithdrawQueueIx = exports.withdrawVaultIx = exports.rolloverVaultIx = exports.collectCollateralIx = exports.burnOptionIx = exports.exerciseOptionIx = exports.acceptAuctionBidIx = exports.cancelAuctionIx = exports.initializeAuctionIx = exports.initializeOptionIx = exports.removeQueuedDepositIx = exports.processDepositQueueIx = exports.depositVaultIx = exports.initializeVaultIx = exports.fundVaultAuthorityIx = exports.updateVaultDepositLimitIx = exports.updateAdminIx = exports.initializeStateIx = void 0;
const vault_1 = require("./vault");

@@ -11,0 +24,0 @@ const flex_1 = require("./../flex/flex");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.displayVault = exports.getVaultWithdrawQueueRedeemableTokenAccountAddress = exports.getWithdrawQueueNodeAddress = exports.getWithdrawQueueHeaderAddress = exports.getDepositQueueNodeAddress = exports.getDepositQueueHeaderAddress = exports.getVaultDepositQueueUnderlyingTokenAccountAddress = exports.getVaultUnderlyingTokenAccountAddress = exports.getVaultAuthorityAddress = exports.getRedeemableMintAddress = exports.getVaultAddress = exports.getStateAddress = exports.VAULT_WITHDRAW_QUEUE_REDEEMABLE_SEED = exports.WITHDRAW_QUEUE_SEED = exports.VAULT_DEPOSIT_QUEUE_UNDERLYING_SEED = exports.DEPOSIT_QUEUE_SEED = exports.USER_REDEEMABLE_SEED = exports.VAULT_AUTHORITY_SEED = exports.VAULT_UNDERLYING_SEED = exports.STATE_SEED = exports.REDEEMABLE_MINT_SEED = void 0;
const vault_1 = require("./vault");

@@ -4,0 +5,0 @@ const web3_js_1 = require("@solana/web3.js");

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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;

@@ -13,2 +25,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.vault = exports.Vault = void 0;
const anchor = __importStar(require("@project-serum/anchor"));

@@ -15,0 +28,0 @@ const covered_call_vault_json_1 = __importDefault(require("../idl/covered_call_vault.json"));

{
"name": "@zetamarkets/flex-sdk",
"version": "0.2.2",
"version": "0.2.3",
"description": "Zeta Flex SDK",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -10,2 +10,3 @@ import * as anchor from "@project-serum/anchor";

Keypair,
TransactionSignature,
} from "@solana/web3.js";

@@ -96,3 +97,6 @@ import { Position, Bid, TokenAcc } from "./types";

public async bidAuction(amount: number, auctionAccount: PublicKey) {
public async bidAuction(
amount: number,
auctionAccount: PublicKey
): Promise<TransactionSignature> {
let auctionAccountInfo = (await Flex.program.account.auctionAccount.fetch(

@@ -201,6 +205,8 @@ auctionAccount

await utils.processTransaction(Program.FLEX, this._provider, tx, [keypair]);
return await utils.processTransaction(Program.FLEX, this._provider, tx, [
keypair,
]);
}
public async cancelBid(bidAccount: PublicKey) {
public async cancelBid(bidAccount: PublicKey): Promise<TransactionSignature> {
let bidToCancel = undefined;

@@ -272,9 +278,5 @@ this._bids.map((bid) => {

try {
await utils.processTransaction(Program.FLEX, this._provider, tx, [
keypair,
]);
} catch (e) {
throw e;
}
return await utils.processTransaction(Program.FLEX, this._provider, tx, [
keypair,
]);
} else {

@@ -285,3 +287,5 @@ throw "Client attempted to cancel non-existent bid.";

public async exerciseOption(optionAccount: PublicKey) {
public async exerciseOption(
optionAccount: PublicKey
): Promise<TransactionSignature> {
await this.updateTokenAccounts();

@@ -367,11 +371,12 @@ let optionAccountInfo = Flex.getOption(optionAccount);

try {
await utils.processTransaction(Program.FLEX, this._provider, tx, [
keypair,
]);
} catch (e) {
throw e;
}
let txSig = await utils.processTransaction(
Program.FLEX,
this._provider,
tx,
[keypair]
);
await this.updateState();
return txSig;
}

@@ -486,3 +491,3 @@

let tokenAccounts: any[] = [];
let tokenAccounts: TokenAcc[] = [];
for (let i = 0; i < accounts.length; i++) {

@@ -489,0 +494,0 @@ let mint = accounts[i].account.data["parsed"]["info"]["mint"];

@@ -240,3 +240,3 @@ import * as anchor from "@project-serum/anchor";

let tx = new Transaction().add(
instructions.expireOptionIx(option, underlying.oracle)
instructions.expireOptionIx(option, underlying.address, underlying.oracle)
);

@@ -274,14 +274,12 @@ await utils.processTransaction(Program.FLEX, this._provider, tx);

accs.map(async (acc) => {
let [flexVaultAddress, _nonce] = await flexUtils.getVaultAddress(
this.programId,
acc.publicKey
let flexVaultAddress = await PublicKey.createProgramAddress(
[
Buffer.from(anchor.utils.bytes.utf8.encode("vault")),
acc.publicKey.toBuffer(),
Buffer.from([acc.account.vaultNonce]),
],
this.programId
);
let [underlying, _] = await flexUtils.getUnderlyingAddress(
this.programId,
acc.account.underlyingMint
);
return {
underlying,
optionAccount: acc.publicKey,

@@ -404,9 +402,14 @@ vault: flexVaultAddress,

let auctionAccount = acc.publicKey;
let [auctionVault, _] = await flexUtils.getAuctionVaultAddress(
this.programId,
acc.account.auctionTokenMint,
acc.account.creator,
acc.account.amount,
acc.account.bidEnd,
acc.account.cooldownEnd
let auctionVault = await PublicKey.createProgramAddress(
[
Buffer.from(anchor.utils.bytes.utf8.encode("auction-vault")),
acc.account.auctionTokenMint.toBuffer(),
acc.account.creator.toBuffer(),
acc.account.amount.toArrayLike(Buffer, "le", 8),
acc.account.bidEnd.toArrayLike(Buffer, "le", 8),
acc.account.cooldownEnd.toArrayLike(Buffer, "le", 8),
Buffer.from([acc.account.auctionVaultNonce]),
],
this.programId
);

@@ -413,0 +416,0 @@

@@ -169,2 +169,3 @@ import * as anchor from "@project-serum/anchor";

option: flexTypes.Option,
underlying: PublicKey,
oracle: PublicKey

@@ -175,3 +176,3 @@ ): TransactionInstruction {

state: Flex.stateAddress,
underlying: option.underlying,
underlying,
collateralMint: option.collateralMint,

@@ -178,0 +179,0 @@ optionAccount: option.optionAccount,

@@ -38,3 +38,2 @@ import { PublicKey } from "@solana/web3.js";

export interface Option {
underlying: PublicKey;
optionAccount: PublicKey;

@@ -41,0 +40,0 @@ vault: PublicKey;

@@ -10,2 +10,3 @@ import * as anchor from "@project-serum/anchor";

AccountMeta,
TransactionSignature,
} from "@solana/web3.js";

@@ -88,3 +89,6 @@ import { DummyWallet, Wallet } from "../common/types";

public async depositVault(vault: PublicKey, amount: anchor.BN) {
public async depositVault(
vault: PublicKey,
amount: anchor.BN
): Promise<TransactionSignature> {
let vaultInfo = Vault.getVault(vault);

@@ -158,5 +162,8 @@ let underlyingTokenAccountAddress: PublicKey;

await utils.processTransaction(Program.VAULT, this._provider, tx, [
keypair,
]);
let txSig = await utils.processTransaction(
Program.VAULT,
this._provider,
tx,
[keypair]
);
await this.updateState();

@@ -180,2 +187,4 @@

}
return txSig;
}

@@ -186,3 +195,3 @@

queueNodeToRemove: PublicKey
) {
): Promise<TransactionSignature> {
let vaultInfo = Vault.getVault(vault);

@@ -261,3 +270,3 @@

await utils.processTransaction(Program.VAULT, this._provider, tx);
return await utils.processTransaction(Program.VAULT, this._provider, tx);
}

@@ -268,3 +277,3 @@

queueNodeToRemove: PublicKey
) {
): Promise<TransactionSignature> {
let vaultInfo = Vault.getVault(vault);

@@ -344,3 +353,3 @@

await utils.processTransaction(Program.VAULT, this._provider, tx);
return await utils.processTransaction(Program.VAULT, this._provider, tx);
}

@@ -372,3 +381,6 @@

public async withdrawVault(vault: PublicKey, amount: anchor.BN) {
public async withdrawVault(
vault: PublicKey,
amount: anchor.BN
): Promise<TransactionSignature> {
let vaultInfo = Vault.getVault(vault);

@@ -438,7 +450,11 @@

await utils.processTransaction(Program.VAULT, this._provider, tx, [
keypair,
]);
let txSig = await utils.processTransaction(
Program.VAULT,
this._provider,
tx,
[keypair]
);
await this.updateState();
console.log(`Withdrawal successful`);
return txSig;
}

@@ -445,0 +461,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc