@alcorexchange/alcor-swap-sdk
Version:
**npm** ``` npm i @alcorexchange/alcor-swap-sdk ``` **yarn** ``` yarn add @alcorexchange/alcor-swap-sdk ``` ## Usage ### Import:
54 lines (48 loc) • 1.84 kB
JavaScript
// constants used internally but not expected to be used externally
export const NEGATIVE_ONE = BigInt(-1);
export const ZERO = BigInt(0);
export const ONE = BigInt(1);
// used in liquidity amount math
export const Q32 = BigInt(2) ** BigInt(32);
export const Q64 = BigInt(2) ** BigInt(64);
export const Q96 = BigInt(2) ** BigInt(96);
export const Q128 = BigInt(2) ** BigInt(128);
export const Q192 = BigInt(2) ** BigInt(192);
export const Q256 = BigInt(2) ** BigInt(256);
export const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
export const MaxUint128 = BigInt("0xffffffffffffffffffffffffffffffff");
export const MaxUint64 = BigInt("0xffffffffffffffff");
// exports for external consumption
export let TradeType = /*#__PURE__*/function (TradeType) {
TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT";
TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT";
return TradeType;
}({});
/**
* The default factory enabled fee amounts, denominated in hundredths of bips.
*/
export let FeeAmount = /*#__PURE__*/function (FeeAmount) {
FeeAmount[FeeAmount["LOW"] = 500] = "LOW";
FeeAmount[FeeAmount["MEDIUM"] = 3000] = "MEDIUM";
FeeAmount[FeeAmount["HIGH"] = 10000] = "HIGH";
return FeeAmount;
}({});
export let Rounding = /*#__PURE__*/function (Rounding) {
Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN";
Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP";
Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP";
return Rounding;
}({});
/**
* The default factory tick spacings by fee amount.
*/
export const TICK_SPACINGS = {
[FeeAmount.LOW]: 10,
[FeeAmount.MEDIUM]: 60,
[FeeAmount.HIGH]: 200
};
// export const TICK_SPACINGS: { [amount in FeeAmount]: number } = {
// [FeeAmount.LOW]: 4,
// [FeeAmount.MEDIUM]: 10,
// [FeeAmount.HIGH]: 50,
// };