@injectivelabs/utils
Advanced tools
Comparing version 0.0.63 to 0.0.64
@@ -0,3 +1,5 @@ | ||
import { Web3GatewayMessage } from '@injectivelabs/ts-types'; | ||
export declare const sleep: (timeout: number) => Promise<void>; | ||
export declare const isServerSide: () => boolean; | ||
export declare const getWeb3GatewayMessage: <T>(message: T, type: string) => Web3GatewayMessage<T>; | ||
//# sourceMappingURL=helpers.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isServerSide = exports.sleep = void 0; | ||
exports.getWeb3GatewayMessage = exports.isServerSide = exports.sleep = void 0; | ||
const snakecase_keys_1 = __importDefault(require("snakecase-keys")); | ||
const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout)); | ||
@@ -8,2 +12,4 @@ exports.sleep = sleep; | ||
exports.isServerSide = isServerSide; | ||
const getWeb3GatewayMessage = (message, type) => (Object.assign(Object.assign({}, (0, snakecase_keys_1.default)(message)), { '@type': type })); | ||
exports.getWeb3GatewayMessage = getWeb3GatewayMessage; | ||
//# sourceMappingURL=helpers.js.map |
@@ -18,2 +18,10 @@ import { BigNumber } from './classes'; | ||
/** | ||
* On chain amounts (based on the cosmosSdk.Dec type) | ||
* broadcasted to a sentry directly using the | ||
* gRPC API should be passed with an extra decimal point | ||
* 18 places from the beginning (i.e multiplied by 1e18), so we need to add it | ||
* to get a workable amount | ||
*/ | ||
export declare const amountToCosmosSdkDecAmount: (value: string | number | BigNumber) => BigNumber; | ||
/** | ||
* Amount that the chain requires is in the x * 10^(quoteDecimals) format | ||
@@ -20,0 +28,0 @@ * where x is a human readable number |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.spotQuantityFromChainQuantityToFixed = exports.spotQuantityFromChainQuantity = exports.spotQuantityToChainQuantityToFixed = exports.spotQuantityToChainQuantity = exports.spotPriceFromChainPriceToFixed = exports.spotPriceFromChainPrice = exports.spotPriceToChainPriceToFixed = exports.spotPriceToChainPrice = exports.derivativeQuantityFromChainQuantityToFixed = exports.derivativeQuantityFromChainQuantity = exports.derivativeQuantityToChainQuantityToFixed = exports.derivativeQuantityToChainQuantity = exports.derivativePriceFromChainPriceToFixed = exports.derivativePriceFromChainPrice = exports.derivativePriceToChainPriceToFixed = exports.derivativePriceToChainPrice = exports.derivativeMarginFromChainMarginToFixed = exports.derivativeMarginFromChainMargin = exports.derivativeMarginToChainMarginToFixed = exports.derivativeMarginToChainMargin = exports.denomAmountFromChainDenomAmountToFixed = exports.denomAmountFromChainDenomAmount = exports.denomAmountToChainDenomAmountToFixed = exports.denomAmountToChainDenomAmount = exports.denomAmountToGrpcChainDenomAmount = exports.denomAmountFromGrpcChainDenomAmount = exports.getSignificantDecimalsFromNumber = void 0; | ||
exports.spotQuantityFromChainQuantityToFixed = exports.spotQuantityFromChainQuantity = exports.spotQuantityToChainQuantityToFixed = exports.spotQuantityToChainQuantity = exports.spotPriceFromChainPriceToFixed = exports.spotPriceFromChainPrice = exports.spotPriceToChainPriceToFixed = exports.spotPriceToChainPrice = exports.derivativeQuantityFromChainQuantityToFixed = exports.derivativeQuantityFromChainQuantity = exports.derivativeQuantityToChainQuantityToFixed = exports.derivativeQuantityToChainQuantity = exports.derivativePriceFromChainPriceToFixed = exports.derivativePriceFromChainPrice = exports.derivativePriceToChainPriceToFixed = exports.derivativePriceToChainPrice = exports.derivativeMarginFromChainMarginToFixed = exports.derivativeMarginFromChainMargin = exports.derivativeMarginToChainMarginToFixed = exports.derivativeMarginToChainMargin = exports.denomAmountFromChainDenomAmountToFixed = exports.denomAmountFromChainDenomAmount = exports.denomAmountToChainDenomAmountToFixed = exports.denomAmountToChainDenomAmount = exports.amountToCosmosSdkDecAmount = exports.denomAmountToGrpcChainDenomAmount = exports.denomAmountFromGrpcChainDenomAmount = exports.getSignificantDecimalsFromNumber = void 0; | ||
const classes_1 = require("./classes"); | ||
@@ -36,2 +36,11 @@ const $BigNumber = classes_1.BigNumber.clone({ ROUNDING_MODE: classes_1.BigNumber.ROUND_DOWN }); | ||
/** | ||
* On chain amounts (based on the cosmosSdk.Dec type) | ||
* broadcasted to a sentry directly using the | ||
* gRPC API should be passed with an extra decimal point | ||
* 18 places from the beginning (i.e multiplied by 1e18), so we need to add it | ||
* to get a workable amount | ||
*/ | ||
const amountToCosmosSdkDecAmount = (value) => new $BigNumber(value).multipliedBy(new $BigNumber(10).pow(18)); | ||
exports.amountToCosmosSdkDecAmount = amountToCosmosSdkDecAmount; | ||
/** | ||
* Amount that the chain requires is in the x * 10^(quoteDecimals) format | ||
@@ -38,0 +47,0 @@ * where x is a human readable number |
{ | ||
"name": "@injectivelabs/utils", | ||
"description": "List of utils and helper functions that can be reused throughout Injective's projects.", | ||
"version": "0.0.63", | ||
"version": "0.0.64", | ||
"license": "MIT", | ||
@@ -30,4 +30,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@injectivelabs/exceptions": "^0.0.45", | ||
"@injectivelabs/ts-types": "^0.0.40", | ||
"@injectivelabs/exceptions": "^0.0.46", | ||
"@injectivelabs/ts-types": "^0.0.41", | ||
"axios": "^0.21.1", | ||
@@ -37,5 +37,6 @@ "bignumber.js": "^9.0.1", | ||
"shx": "^0.3.2", | ||
"snakecase-keys": "^5.1.2", | ||
"store2": "^2.12.0" | ||
}, | ||
"gitHead": "787ad83e119ad03f33489a2cfc35d41259993425" | ||
"gitHead": "a04fe2b57ef24f7bb0c3cb57a53f3414ba3577a8" | ||
} |
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
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
75733
989
8
+ Addedsnakecase-keys@^5.1.2
+ Added@injectivelabs/exceptions@0.0.46(transitive)
+ Added@injectivelabs/ts-types@0.0.41(transitive)
+ Addeddot-case@3.0.4(transitive)
+ Addedlower-case@2.0.2(transitive)
+ Addedmap-obj@4.3.0(transitive)
+ Addedno-case@3.0.4(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsnake-case@3.0.4(transitive)
+ Addedsnakecase-keys@5.5.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedtype-fest@3.13.1(transitive)
- Removed@injectivelabs/exceptions@0.0.45(transitive)
- Removed@injectivelabs/ts-types@0.0.40(transitive)
- Removedresolve@1.22.9(transitive)