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

@openbook-dex/openbook-v2

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openbook-dex/openbook-v2 - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

3

dist/cjs/client.d.ts

@@ -39,2 +39,3 @@ /// <reference types="bn.js" />

sendAndConfirmTransaction(ixs: TransactionInstruction[], opts?: any): Promise<string>;
createProgramAccount(authority: Keypair, size: number): Promise<PublicKey>;
getMarket(publicKey: PublicKey): Promise<MarketAccount | null>;

@@ -46,3 +47,3 @@ getOpenOrders(publicKey: PublicKey): Promise<OpenOrdersAccount | null>;

getLeafNodes(bookside: BookSideAccount): LeafNode[];
createMarket(payer: Keypair, name: string, quoteMint: PublicKey, baseMint: PublicKey, quoteLoteSize: BN, baseLoteSize: BN, makerFee: BN, takerFee: BN, timeExpiry: BN, oracleA: PublicKey | null, oracleB: PublicKey | null, openOrdersAdmin: PublicKey | null, consumeEventsAdmin: PublicKey | null, closeMarketAdmin: PublicKey | null, oracleConfigParams?: OracleConfigParams, collectFeeAdmin?: PublicKey): Promise<TransactionSignature>;
createMarket(payer: Keypair, name: string, quoteMint: PublicKey, baseMint: PublicKey, quoteLoteSize: BN, baseLoteSize: BN, makerFee: BN, takerFee: BN, timeExpiry: BN, oracleA: PublicKey | null, oracleB: PublicKey | null, openOrdersAdmin: PublicKey | null, consumeEventsAdmin: PublicKey | null, closeMarketAdmin: PublicKey | null, oracleConfigParams?: OracleConfigParams, collectFeeAdmin?: PublicKey): Promise<string>;
findOpenOrdersIndexer(market: PublicKey): PublicKey;

@@ -49,0 +50,0 @@ createOpenOrdersIndexer(market: PublicKey, openOrdersIndexer: PublicKey): Promise<TransactionSignature>;

@@ -39,2 +39,4 @@ "use strict";

exports.nameToString = nameToString;
const booksideSpace = 90944 + 8;
const eventQueueSpace = 91280 + 8;
class OpenBookV2Client {

@@ -80,2 +82,17 @@ programId;

}
async createProgramAccount(authority, size) {
const lamports = await this.connection.getMinimumBalanceForRentExemption(size);
const address = web3_js_1.Keypair.generate();
const tx = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.createAccount({
fromPubkey: authority.publicKey,
newAccountPubkey: address.publicKey,
lamports,
space: size,
programId: this.programId,
})).instructions;
await this.sendAndConfirmTransaction(tx, {
additionalSigners: [authority, address],
});
return address.publicKey;
}
async getMarket(publicKey) {

@@ -130,28 +147,5 @@ try {

}, collectFeeAdmin) {
const bids = web3_js_1.Keypair.generate().publicKey;
const booksideSpace = 90944 + 8;
const ix0 = web3_js_1.SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: bids,
lamports: await this.connection.getMinimumBalanceForRentExemption(booksideSpace),
space: booksideSpace,
programId: web3_js_1.SystemProgram.programId,
});
const asks = web3_js_1.Keypair.generate().publicKey;
const ix1 = web3_js_1.SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: asks,
lamports: await this.connection.getMinimumBalanceForRentExemption(booksideSpace),
space: booksideSpace,
programId: web3_js_1.SystemProgram.programId,
});
const eventQueue = web3_js_1.Keypair.generate().publicKey;
const eventQueueSpace = 91288;
const ix2 = web3_js_1.SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: eventQueue,
lamports: await this.connection.getMinimumBalanceForRentExemption(eventQueueSpace),
space: eventQueueSpace,
programId: web3_js_1.SystemProgram.programId,
});
const bids = await this.createProgramAccount(payer, booksideSpace);
const asks = await this.createProgramAccount(payer, booksideSpace);
const eventQueue = await this.createProgramAccount(payer, eventQueueSpace);
const market = web3_js_1.Keypair.generate();

@@ -186,3 +180,5 @@ const [marketAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('Market'), market.publicKey.toBuffer()], this.program.programId);

.instruction();
return await this.sendAndConfirmTransaction([ix0, ix1, ix2, ix]);
return await this.sendAndConfirmTransaction([ix], {
additionalSigners: [payer, market],
});
}

@@ -189,0 +185,0 @@ findOpenOrdersIndexer(market) {

@@ -1,2 +0,1 @@

import { PublicKey } from '@solana/web3.js';
export declare const Side: {

@@ -10,2 +9,1 @@ Bid: {

};
export declare const ProgramId: PublicKey;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgramId = exports.Side = void 0;
const web3_js_1 = require("@solana/web3.js");
exports.Side = void 0;
exports.Side = {

@@ -9,2 +8,1 @@ Bid: { bid: {} },

};
exports.ProgramId = new web3_js_1.PublicKey('8qkavBpvoHVYkmPhu6QRpXRX39Kcop9uMXvZorBAz43o');
import { BN, Program, } from '@coral-xyz/anchor';
import { utf8 } from '@coral-xyz/anchor/dist/cjs/utils/bytes';
import { MintLayout, NATIVE_MINT, TOKEN_PROGRAM_ID, createCloseAccountInstruction, createInitializeAccount3Instruction, } from '@solana/spl-token';
import { Keypair, PublicKey, SystemProgram, } from '@solana/web3.js';
import { Keypair, PublicKey, SystemProgram, Transaction, } from '@solana/web3.js';
import * as splToken from '@solana/spl-token';

@@ -12,2 +12,4 @@ import { IDL } from './openbook_v2';

}
const booksideSpace = 90944 + 8;
const eventQueueSpace = 91280 + 8;
export class OpenBookV2Client {

@@ -53,2 +55,17 @@ programId;

}
async createProgramAccount(authority, size) {
const lamports = await this.connection.getMinimumBalanceForRentExemption(size);
const address = Keypair.generate();
const tx = new Transaction().add(SystemProgram.createAccount({
fromPubkey: authority.publicKey,
newAccountPubkey: address.publicKey,
lamports,
space: size,
programId: this.programId,
})).instructions;
await this.sendAndConfirmTransaction(tx, {
additionalSigners: [authority, address],
});
return address.publicKey;
}
async getMarket(publicKey) {

@@ -103,28 +120,5 @@ try {

}, collectFeeAdmin) {
const bids = Keypair.generate().publicKey;
const booksideSpace = 90944 + 8;
const ix0 = SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: bids,
lamports: await this.connection.getMinimumBalanceForRentExemption(booksideSpace),
space: booksideSpace,
programId: SystemProgram.programId,
});
const asks = Keypair.generate().publicKey;
const ix1 = SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: asks,
lamports: await this.connection.getMinimumBalanceForRentExemption(booksideSpace),
space: booksideSpace,
programId: SystemProgram.programId,
});
const eventQueue = Keypair.generate().publicKey;
const eventQueueSpace = 91288;
const ix2 = SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: eventQueue,
lamports: await this.connection.getMinimumBalanceForRentExemption(eventQueueSpace),
space: eventQueueSpace,
programId: SystemProgram.programId,
});
const bids = await this.createProgramAccount(payer, booksideSpace);
const asks = await this.createProgramAccount(payer, booksideSpace);
const eventQueue = await this.createProgramAccount(payer, eventQueueSpace);
const market = Keypair.generate();

@@ -159,3 +153,5 @@ const [marketAuthority] = PublicKey.findProgramAddressSync([Buffer.from('Market'), market.publicKey.toBuffer()], this.program.programId);

.instruction();
return await this.sendAndConfirmTransaction([ix0, ix1, ix2, ix]);
return await this.sendAndConfirmTransaction([ix], {
additionalSigners: [payer, market],
});
}

@@ -162,0 +158,0 @@ findOpenOrdersIndexer(market) {

@@ -1,2 +0,1 @@

import { PublicKey } from '@solana/web3.js';
export const Side = {

@@ -6,2 +5,1 @@ Bid: { bid: {} },

};
export const ProgramId = new PublicKey('8qkavBpvoHVYkmPhu6QRpXRX39Kcop9uMXvZorBAz43o');

@@ -39,2 +39,3 @@ /// <reference types="bn.js" />

sendAndConfirmTransaction(ixs: TransactionInstruction[], opts?: any): Promise<string>;
createProgramAccount(authority: Keypair, size: number): Promise<PublicKey>;
getMarket(publicKey: PublicKey): Promise<MarketAccount | null>;

@@ -46,3 +47,3 @@ getOpenOrders(publicKey: PublicKey): Promise<OpenOrdersAccount | null>;

getLeafNodes(bookside: BookSideAccount): LeafNode[];
createMarket(payer: Keypair, name: string, quoteMint: PublicKey, baseMint: PublicKey, quoteLoteSize: BN, baseLoteSize: BN, makerFee: BN, takerFee: BN, timeExpiry: BN, oracleA: PublicKey | null, oracleB: PublicKey | null, openOrdersAdmin: PublicKey | null, consumeEventsAdmin: PublicKey | null, closeMarketAdmin: PublicKey | null, oracleConfigParams?: OracleConfigParams, collectFeeAdmin?: PublicKey): Promise<TransactionSignature>;
createMarket(payer: Keypair, name: string, quoteMint: PublicKey, baseMint: PublicKey, quoteLoteSize: BN, baseLoteSize: BN, makerFee: BN, takerFee: BN, timeExpiry: BN, oracleA: PublicKey | null, oracleB: PublicKey | null, openOrdersAdmin: PublicKey | null, consumeEventsAdmin: PublicKey | null, closeMarketAdmin: PublicKey | null, oracleConfigParams?: OracleConfigParams, collectFeeAdmin?: PublicKey): Promise<string>;
findOpenOrdersIndexer(market: PublicKey): PublicKey;

@@ -49,0 +50,0 @@ createOpenOrdersIndexer(market: PublicKey, openOrdersIndexer: PublicKey): Promise<TransactionSignature>;

@@ -1,2 +0,1 @@

import { PublicKey } from '@solana/web3.js';
export declare const Side: {

@@ -10,3 +9,2 @@ Bid: {

};
export declare const ProgramId: PublicKey;
//# sourceMappingURL=utils.d.ts.map
{
"name": "@openbook-dex/openbook-v2",
"version": "0.0.4",
"version": "0.0.5",
"description": "Typescript Client for openbook-v2 program.",

@@ -5,0 +5,0 @@ "repository": "https://github.com/openbook-dex/openbook-v2/",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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