@orca-so/whirlpool-sdk
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -23,3 +23,3 @@ "use strict"; | ||
const tokenPriceB = tokenPrices[tokenMintB.toBase58()]; | ||
if (!tokenPriceA || !tokenPriceB || tickLowerIndex >= tickUpperIndex) { | ||
if (!fees24h || !tokenPriceA || !tokenPriceB || tickLowerIndex >= tickUpperIndex) { | ||
return exports.ZERO_APR; | ||
@@ -26,0 +26,0 @@ } |
@@ -12,1 +12,10 @@ /// <reference types="bn.js" /> | ||
export declare function priceToTickIndex(price: Decimal, decimalsA: number, decimalsB: number): number; | ||
/** | ||
* Get the startIndex of the tick array containing tickIndex. | ||
* | ||
* @param tickIndex | ||
* @param tickSpacing | ||
* @param offset can be used to get neighboring tick array startIndex. | ||
* @returns | ||
*/ | ||
export declare function getStartTickIndex(tickIndex: number, tickSpacing: number, offset?: number): number; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.priceToTickIndex = exports.tickIndexToPrice = exports.priceToSqrtX64 = exports.sqrtPriceX64ToPrice = exports.getPrevValidTickIndex = exports.getNextValidTickIndex = exports.getNearestValidTickIndex = exports.getNearestValidTickIndexFromTickIndex = void 0; | ||
exports.getStartTickIndex = exports.priceToTickIndex = exports.tickIndexToPrice = exports.priceToSqrtX64 = exports.sqrtPriceX64ToPrice = exports.getPrevValidTickIndex = exports.getNextValidTickIndex = exports.getNearestValidTickIndex = exports.getNearestValidTickIndexFromTickIndex = void 0; | ||
const whirlpool_client_sdk_1 = require("@orca-so/whirlpool-client-sdk"); | ||
@@ -45,1 +45,15 @@ const decimal_js_1 = __importDefault(require("decimal.js")); | ||
exports.priceToTickIndex = priceToTickIndex; | ||
/** | ||
* Get the startIndex of the tick array containing tickIndex. | ||
* | ||
* @param tickIndex | ||
* @param tickSpacing | ||
* @param offset can be used to get neighboring tick array startIndex. | ||
* @returns | ||
*/ | ||
function getStartTickIndex(tickIndex, tickSpacing, offset = 0) { | ||
const realIndex = Math.floor(tickIndex / tickSpacing / whirlpool_client_sdk_1.TICK_ARRAY_SIZE); | ||
const startTickIndex = (realIndex + offset) * tickSpacing * whirlpool_client_sdk_1.TICK_ARRAY_SIZE; | ||
return startTickIndex; | ||
} | ||
exports.getStartTickIndex = getStartTickIndex; |
{ | ||
"name": "@orca-so/whirlpool-sdk", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Whirlpool SDK for the Orca protocol.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
290562
109
5126