New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mysten/deepbook-v3

Package Overview
Dependencies
Maintainers
0
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/deepbook-v3 - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

CHANGELOG.md
# @mysten/deepbook-v3
## 0.4.1
### Patch Changes
- 3221141: Book param function and package upgrade
## 0.4.0

@@ -4,0 +10,0 @@

@@ -188,2 +188,12 @@ import type { SuiClient } from '@mysten/sui/client';

/**
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
*/
poolBookParams(poolKey: string): Promise<{
tickSize: number;
lotSize: number;
minSize: number;
}>;
/**
* @description Get the account information for a given pool and balance manager

@@ -190,0 +200,0 @@ * @param {string} poolKey Key of the pool

@@ -414,2 +414,26 @@ "use strict";

/**
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
*/
async poolBookParams(poolKey) {
const tx = new import_transactions.Transaction();
const pool = __privateGet(this, _config).getPool(poolKey);
const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
tx.add(this.deepBook.poolBookParams(poolKey));
const res = await this.client.devInspectTransactionBlock({
sender: (0, import_utils.normalizeSuiAddress)(__privateGet(this, _address)),
transactionBlock: tx
});
const tickSize = Number(import_bcs.bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
const lotSize = Number(import_bcs.bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
const minSize = Number(import_bcs.bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
return {
tickSize: Number(tickSize * baseScalar / quoteScalar / import_config.FLOAT_SCALAR),
lotSize: Number(lotSize / baseScalar),
minSize: Number(minSize / baseScalar)
};
}
/**
* @description Get the account information for a given pool and balance manager

@@ -416,0 +440,0 @@ * @param {string} poolKey Key of the pool

@@ -190,2 +190,8 @@ import type { Transaction } from '@mysten/sui/transactions';

/**
* @description Get the book parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns A function that takes a Transaction object
*/
poolBookParams: (poolKey: string) => (tx: Transaction) => void;
/**
* @description Get the account information for a given pool and balance manager

@@ -192,0 +198,0 @@ * @param {string} poolKey Key of the pool

@@ -564,2 +564,17 @@ "use strict";

/**
* @description Get the book parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns A function that takes a Transaction object
*/
this.poolBookParams = (poolKey) => (tx) => {
const pool = __privateGet(this, _config).getPool(poolKey);
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
tx.moveCall({
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::pool_book_params`,
arguments: [tx.object(pool.address)],
typeArguments: [baseCoin.type, quoteCoin.type]
});
};
/**
* @description Get the account information for a given pool and balance manager

@@ -566,0 +581,0 @@ * @param {string} poolKey Key of the pool

2

dist/cjs/utils/constants.js

@@ -30,3 +30,3 @@ "use strict";

const testnetPackageIds = {
DEEPBOOK_PACKAGE_ID: "0x4251db4eb0622b82c8729f5d1b4a2db010a82d5493c706c14174a69ab9e6b4f1",
DEEPBOOK_PACKAGE_ID: "0xc89b2bd6172c077aec6e8d7ba201e99c32f9770cdae7be6dac9d95132fff8e8e",
REGISTRY_ID: "0x9162317a81a9eb66ecd42705529b2a39c7805f98f42312275c2e7a599d518437",

@@ -33,0 +33,0 @@ DEEP_TREASURY_ID: "0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb"

@@ -188,2 +188,12 @@ import type { SuiClient } from '@mysten/sui/client';

/**
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
*/
poolBookParams(poolKey: string): Promise<{
tickSize: number;
lotSize: number;
minSize: number;
}>;
/**
* @description Get the account information for a given pool and balance manager

@@ -190,0 +200,0 @@ * @param {string} poolKey Key of the pool

@@ -391,2 +391,26 @@ var __typeError = (msg) => {

/**
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
*/
async poolBookParams(poolKey) {
const tx = new Transaction();
const pool = __privateGet(this, _config).getPool(poolKey);
const baseScalar = __privateGet(this, _config).getCoin(pool.baseCoin).scalar;
const quoteScalar = __privateGet(this, _config).getCoin(pool.quoteCoin).scalar;
tx.add(this.deepBook.poolBookParams(poolKey));
const res = await this.client.devInspectTransactionBlock({
sender: normalizeSuiAddress(__privateGet(this, _address)),
transactionBlock: tx
});
const tickSize = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[0][0])));
const lotSize = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[1][0])));
const minSize = Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0])));
return {
tickSize: Number(tickSize * baseScalar / quoteScalar / FLOAT_SCALAR),
lotSize: Number(lotSize / baseScalar),
minSize: Number(minSize / baseScalar)
};
}
/**
* @description Get the account information for a given pool and balance manager

@@ -393,0 +417,0 @@ * @param {string} poolKey Key of the pool

@@ -190,2 +190,8 @@ import type { Transaction } from '@mysten/sui/transactions';

/**
* @description Get the book parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns A function that takes a Transaction object
*/
poolBookParams: (poolKey: string) => (tx: Transaction) => void;
/**
* @description Get the account information for a given pool and balance manager

@@ -192,0 +198,0 @@ * @param {string} poolKey Key of the pool

@@ -541,2 +541,17 @@ var __typeError = (msg) => {

/**
* @description Get the book parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns A function that takes a Transaction object
*/
this.poolBookParams = (poolKey) => (tx) => {
const pool = __privateGet(this, _config).getPool(poolKey);
const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
tx.moveCall({
target: `${__privateGet(this, _config).DEEPBOOK_PACKAGE_ID}::pool::pool_book_params`,
arguments: [tx.object(pool.address)],
typeArguments: [baseCoin.type, quoteCoin.type]
});
};
/**
* @description Get the account information for a given pool and balance manager

@@ -543,0 +558,0 @@ * @param {string} poolKey Key of the pool

const testnetPackageIds = {
DEEPBOOK_PACKAGE_ID: "0x4251db4eb0622b82c8729f5d1b4a2db010a82d5493c706c14174a69ab9e6b4f1",
DEEPBOOK_PACKAGE_ID: "0xc89b2bd6172c077aec6e8d7ba201e99c32f9770cdae7be6dac9d95132fff8e8e",
REGISTRY_ID: "0x9162317a81a9eb66ecd42705529b2a39c7805f98f42312275c2e7a599d518437",

@@ -4,0 +4,0 @@ DEEP_TREASURY_ID: "0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb"

@@ -5,3 +5,3 @@ {

"description": "Sui Deepbook SDK",
"version": "0.4.0",
"version": "0.4.1",
"license": "Apache-2.0",

@@ -8,0 +8,0 @@ "type": "commonjs",

@@ -464,2 +464,30 @@ // Copyright (c) Mysten Labs, Inc.

/**
* @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
*/
async poolBookParams(poolKey: string) {
const tx = new Transaction();
const pool = this.#config.getPool(poolKey);
const baseScalar = this.#config.getCoin(pool.baseCoin).scalar;
const quoteScalar = this.#config.getCoin(pool.quoteCoin).scalar;
tx.add(this.deepBook.poolBookParams(poolKey));
const res = await this.client.devInspectTransactionBlock({
sender: normalizeSuiAddress(this.#address),
transactionBlock: tx,
});
const tickSize = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![0][0])));
const lotSize = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![1][0])));
const minSize = Number(bcs.U64.parse(new Uint8Array(res.results![0].returnValues![2][0])));
return {
tickSize: Number((tickSize * baseScalar) / quoteScalar / FLOAT_SCALAR),
lotSize: Number(lotSize / baseScalar),
minSize: Number(minSize / baseScalar),
};
}
/**
* @description Get the account information for a given pool and balance manager

@@ -466,0 +494,0 @@ * @param {string} poolKey Key of the pool

@@ -617,2 +617,19 @@ // Copyright (c) Mysten Labs, Inc.

/**
* @description Get the book parameters for a given pool, including tick size, lot size, and min size.
* @param {string} poolKey Key of the pool
* @returns A function that takes a Transaction object
*/
poolBookParams = (poolKey: string) => (tx: Transaction) => {
const pool = this.#config.getPool(poolKey);
const baseCoin = this.#config.getCoin(pool.baseCoin);
const quoteCoin = this.#config.getCoin(pool.quoteCoin);
tx.moveCall({
target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::pool_book_params`,
arguments: [tx.object(pool.address)],
typeArguments: [baseCoin.type, quoteCoin.type],
});
};
/**
* @description Get the account information for a given pool and balance manager

@@ -619,0 +636,0 @@ * @param {string} poolKey Key of the pool

@@ -15,3 +15,3 @@ // Copyright (c) Mysten Labs, Inc.

export const testnetPackageIds = {
DEEPBOOK_PACKAGE_ID: '0x4251db4eb0622b82c8729f5d1b4a2db010a82d5493c706c14174a69ab9e6b4f1',
DEEPBOOK_PACKAGE_ID: '0xc89b2bd6172c077aec6e8d7ba201e99c32f9770cdae7be6dac9d95132fff8e8e',
REGISTRY_ID: '0x9162317a81a9eb66ecd42705529b2a39c7805f98f42312275c2e7a599d518437',

@@ -18,0 +18,0 @@ DEEP_TREASURY_ID: '0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb',

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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