@openbook-dex/openbook-v2
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -62,4 +62,4 @@ /// <reference types="bn.js" /> | ||
findOpenOrdersForMarket(owner: PublicKey | undefined, market: PublicKey): Promise<PublicKey[]>; | ||
createOpenOrdersInstruction(market: PublicKey, accountIndex: BN, name: string, owner: PublicKey | undefined, delegateAccount: PublicKey | null, openOrdersIndexer?: PublicKey): Promise<[TransactionInstruction[], PublicKey]>; | ||
createOpenOrders(payer: Keypair, market: PublicKey, accountIndex: BN, name: string, owner?: Keypair, openOrdersIndexer?: PublicKey | null): Promise<PublicKey>; | ||
createOpenOrdersInstruction(market: PublicKey, accountIndex: BN, name: string, owner: PublicKey | undefined, delegateAccount: PublicKey | null, openOrdersIndexer?: PublicKey | null): Promise<[TransactionInstruction[], PublicKey]>; | ||
createOpenOrders(payer: Keypair, market: PublicKey, accountIndex: BN, name: string, owner?: Keypair, delegateAccount?: PublicKey | null, openOrdersIndexer?: PublicKey | null): Promise<PublicKey>; | ||
deposit(openOrdersPublicKey: PublicKey, openOrdersAccount: OpenOrdersAccount, market: MarketAccount, userBaseAccount: PublicKey, userQuoteAccount: PublicKey, baseAmount: BN, quoteAmount: BN): Promise<TransactionSignature>; | ||
@@ -66,0 +66,0 @@ depositNative(openOrdersPublicKey: PublicKey, openOrdersAccount: OpenOrdersAccount, market: MarketAccount, userBaseAccount: PublicKey, userQuoteAccount: PublicKey, baseAmount: BN, quoteAmount: BN): Promise<TransactionSignature>; |
@@ -292,4 +292,4 @@ "use strict"; | ||
} | ||
async createOpenOrders(payer, market, accountIndex, name, owner = payer, openOrdersIndexer = null) { | ||
const [ixs, openOrdersAccount] = await this.createOpenOrdersInstruction(market, accountIndex, name, owner.publicKey, openOrdersIndexer); | ||
async createOpenOrders(payer, market, accountIndex, name, owner = payer, delegateAccount = null, openOrdersIndexer = null) { | ||
const [ixs, openOrdersAccount] = await this.createOpenOrdersInstruction(market, accountIndex, name, owner.publicKey, delegateAccount, openOrdersIndexer); | ||
const additionalSigners = [payer]; | ||
@@ -296,0 +296,0 @@ if (owner !== payer) { |
@@ -5,2 +5,3 @@ import { PublicKey, TransactionInstruction } from '@solana/web3.js'; | ||
export declare const I64_MAX_BN: BN; | ||
export declare const QUOTE_DECIMALS = 6; | ||
export declare function bpsToDecimal(bps: number): number; | ||
@@ -10,4 +11,4 @@ export declare function percentageToDecimal(percentage: number): number; | ||
export declare function toUiDecimals(nativeAmount: number, decimals: number): number; | ||
export declare const QUOTE_DECIMALS = 6; | ||
export declare function toUiDecimalsForQuote(nativeAmount: number): number; | ||
export declare function nativeToUiDecimalsForQuote(nativeAmount: number, quoteDecimals?: number): number; | ||
export declare function nativeToUiDecimalsForBase(nativeAmount: number, baseDecimals: number): number; | ||
export declare function roundTo5(number: any): number; | ||
@@ -14,0 +15,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createAssociatedTokenAccountIdempotentInstruction = exports.getAssociatedTokenAddress = exports.roundTo5 = exports.toUiDecimalsForQuote = exports.QUOTE_DECIMALS = exports.toUiDecimals = exports.toNative = exports.percentageToDecimal = exports.bpsToDecimal = exports.I64_MAX_BN = exports.U64_MAX_BN = void 0; | ||
exports.createAssociatedTokenAccountIdempotentInstruction = exports.getAssociatedTokenAddress = exports.roundTo5 = exports.nativeToUiDecimalsForBase = exports.nativeToUiDecimalsForQuote = exports.toUiDecimals = exports.toNative = exports.percentageToDecimal = exports.bpsToDecimal = exports.QUOTE_DECIMALS = exports.I64_MAX_BN = exports.U64_MAX_BN = void 0; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
@@ -16,2 +16,3 @@ const bn_js_1 = __importDefault(require("bn.js")); | ||
exports.I64_MAX_BN = new bn_js_1.default('9223372036854775807').toTwos(64); | ||
exports.QUOTE_DECIMALS = 6; | ||
function bpsToDecimal(bps) { | ||
@@ -33,7 +34,10 @@ return bps / 10000; | ||
exports.toUiDecimals = toUiDecimals; | ||
exports.QUOTE_DECIMALS = 6; | ||
function toUiDecimalsForQuote(nativeAmount) { | ||
function nativeToUiDecimalsForQuote(nativeAmount, quoteDecimals = exports.QUOTE_DECIMALS) { | ||
return toUiDecimals(nativeAmount, exports.QUOTE_DECIMALS); | ||
} | ||
exports.toUiDecimalsForQuote = toUiDecimalsForQuote; | ||
exports.nativeToUiDecimalsForQuote = nativeToUiDecimalsForQuote; | ||
function nativeToUiDecimalsForBase(nativeAmount, baseDecimals) { | ||
return toUiDecimals(nativeAmount, baseDecimals); | ||
} | ||
exports.nativeToUiDecimalsForBase = nativeToUiDecimalsForBase; | ||
function roundTo5(number) { | ||
@@ -40,0 +44,0 @@ if (number < 1) { |
@@ -288,4 +288,4 @@ import { BN, Program, } from '@coral-xyz/anchor'; | ||
} | ||
async createOpenOrders(payer, market, accountIndex, name, owner = payer, openOrdersIndexer = null) { | ||
const [ixs, openOrdersAccount] = await this.createOpenOrdersInstruction(market, accountIndex, name, owner.publicKey, openOrdersIndexer); | ||
async createOpenOrders(payer, market, accountIndex, name, owner = payer, delegateAccount = null, openOrdersIndexer = null) { | ||
const [ixs, openOrdersAccount] = await this.createOpenOrdersInstruction(market, accountIndex, name, owner.publicKey, delegateAccount, openOrdersIndexer); | ||
const additionalSigners = [payer]; | ||
@@ -292,0 +292,0 @@ if (owner !== payer) { |
@@ -9,2 +9,3 @@ import { PublicKey, SystemProgram, TransactionInstruction, } from '@solana/web3.js'; | ||
export const I64_MAX_BN = new BN('9223372036854775807').toTwos(64); | ||
export const QUOTE_DECIMALS = 6; | ||
export function bpsToDecimal(bps) { | ||
@@ -22,6 +23,8 @@ return bps / 10000; | ||
} | ||
export const QUOTE_DECIMALS = 6; | ||
export function toUiDecimalsForQuote(nativeAmount) { | ||
export function nativeToUiDecimalsForQuote(nativeAmount, quoteDecimals = QUOTE_DECIMALS) { | ||
return toUiDecimals(nativeAmount, QUOTE_DECIMALS); | ||
} | ||
export function nativeToUiDecimalsForBase(nativeAmount, baseDecimals) { | ||
return toUiDecimals(nativeAmount, baseDecimals); | ||
} | ||
export function roundTo5(number) { | ||
@@ -28,0 +31,0 @@ if (number < 1) { |
@@ -62,4 +62,4 @@ /// <reference types="bn.js" /> | ||
findOpenOrdersForMarket(owner: PublicKey | undefined, market: PublicKey): Promise<PublicKey[]>; | ||
createOpenOrdersInstruction(market: PublicKey, accountIndex: BN, name: string, owner: PublicKey | undefined, delegateAccount: PublicKey | null, openOrdersIndexer?: PublicKey): Promise<[TransactionInstruction[], PublicKey]>; | ||
createOpenOrders(payer: Keypair, market: PublicKey, accountIndex: BN, name: string, owner?: Keypair, openOrdersIndexer?: PublicKey | null): Promise<PublicKey>; | ||
createOpenOrdersInstruction(market: PublicKey, accountIndex: BN, name: string, owner: PublicKey | undefined, delegateAccount: PublicKey | null, openOrdersIndexer?: PublicKey | null): Promise<[TransactionInstruction[], PublicKey]>; | ||
createOpenOrders(payer: Keypair, market: PublicKey, accountIndex: BN, name: string, owner?: Keypair, delegateAccount?: PublicKey | null, openOrdersIndexer?: PublicKey | null): Promise<PublicKey>; | ||
deposit(openOrdersPublicKey: PublicKey, openOrdersAccount: OpenOrdersAccount, market: MarketAccount, userBaseAccount: PublicKey, userQuoteAccount: PublicKey, baseAmount: BN, quoteAmount: BN): Promise<TransactionSignature>; | ||
@@ -66,0 +66,0 @@ depositNative(openOrdersPublicKey: PublicKey, openOrdersAccount: OpenOrdersAccount, market: MarketAccount, userBaseAccount: PublicKey, userQuoteAccount: PublicKey, baseAmount: BN, quoteAmount: BN): Promise<TransactionSignature>; |
@@ -5,2 +5,3 @@ import { PublicKey, TransactionInstruction } from '@solana/web3.js'; | ||
export declare const I64_MAX_BN: BN; | ||
export declare const QUOTE_DECIMALS = 6; | ||
export declare function bpsToDecimal(bps: number): number; | ||
@@ -10,4 +11,4 @@ export declare function percentageToDecimal(percentage: number): number; | ||
export declare function toUiDecimals(nativeAmount: number, decimals: number): number; | ||
export declare const QUOTE_DECIMALS = 6; | ||
export declare function toUiDecimalsForQuote(nativeAmount: number): number; | ||
export declare function nativeToUiDecimalsForQuote(nativeAmount: number, quoteDecimals?: number): number; | ||
export declare function nativeToUiDecimalsForBase(nativeAmount: number, baseDecimals: number): number; | ||
export declare function roundTo5(number: any): number; | ||
@@ -14,0 +15,0 @@ /** |
{ | ||
"name": "@openbook-dex/openbook-v2", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
636441
16877