@injectivelabs/utils 0.0.55 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/BigNumberInBase.js +1 -0
- package/dist/classes/BigNumberInBase.js.map +1 -1
- package/dist/classes/BigNumberInWei.js +1 -0
- package/dist/classes/BigNumberInWei.js.map +1 -1
- package/dist/numbers.d.ts +60 -10
- package/dist/numbers.d.ts.map +1 -1
- package/dist/numbers.js +60 -30
- package/dist/numbers.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// eslint-disable-next-line import/no-cycle
|
|
6
7
|
const BigNumberInWei_1 = __importDefault(require("./BigNumberInWei"));
|
|
7
8
|
const BigNumber_1 = __importDefault(require("./BigNumber"));
|
|
8
9
|
class BigNumberInBase extends BigNumber_1.default {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BigNumberInBase.js","sourceRoot":"","sources":["../../src/classes/BigNumberInBase.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"BigNumberInBase.js","sourceRoot":"","sources":["../../src/classes/BigNumberInBase.ts"],"names":[],"mappings":";;;;;AAAA,2CAA2C;AAC3C,sEAA6C;AAC7C,4DAAmC;AAEnC,MAAqB,eAAgB,SAAQ,mBAAS;IACpD,MAAM,CAAC,IAAI,CAAC,MAAuB;QACjC,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,CAAkB,EAAE,IAAa;QACrC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC,CAAkB,EAAE,IAAa;QACpC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,SAAS,CAAC,CAAkB,EAAE,IAAa;QACzC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACtD,CAAC;IAED,GAAG,CAAC,CAAkB,EAAE,IAAa;QACnC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,YAAY,CAAC,CAAkB,EAAE,IAAa;QAC5C,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,CAAkB,EAAE,IAAa;QACrC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;IAED,GAAG,CAAC,CAAkB,EAAE,IAAa;QACnC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,KAAK,CAAC,QAAQ,GAAG,EAAE;QACjB,OAAO,IAAI,wBAAc,CACvB,KAAK,CAAC,YAAY,CAAC,IAAI,mBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CACpD,CAAA;IACH,CAAC;CACF;AAtCD,kCAsCC"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// eslint-disable-next-line import/no-cycle
|
|
6
7
|
const BigNumberInBase_1 = __importDefault(require("./BigNumberInBase"));
|
|
7
8
|
const BigNumber_1 = __importDefault(require("./BigNumber"));
|
|
8
9
|
class BigNumberInWei extends BigNumber_1.default {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BigNumberInWei.js","sourceRoot":"","sources":["../../src/classes/BigNumberInWei.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"BigNumberInWei.js","sourceRoot":"","sources":["../../src/classes/BigNumberInWei.ts"],"names":[],"mappings":";;;;;AAAA,2CAA2C;AAC3C,wEAA+C;AAC/C,4DAAmC;AAEnC,MAAqB,cAAe,SAAQ,mBAAS;IACnD,MAAM,CAAC,IAAI,CAAC,MAAuB;QACjC,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,CAAkB,EAAE,IAAa;QACrC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,CAAC,CAAkB,EAAE,IAAa;QACpC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAChD,CAAC;IAED,SAAS,CAAC,CAAkB,EAAE,IAAa;QACzC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACrD,CAAC;IAED,GAAG,CAAC,CAAkB,EAAE,IAAa;QACnC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED,YAAY,CAAC,CAAkB,EAAE,IAAa;QAC5C,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD,CAAC;IAED,KAAK,CAAC,CAAkB,EAAE,IAAa;QACrC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,GAAG,CAAC,CAAkB,EAAE,IAAa;QACnC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED,MAAM,CAAC,QAAQ,GAAG,EAAE;QAClB,OAAO,IAAI,yBAAe,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,mBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC9E,CAAC;CACF;AApCD,iCAoCC"}
|
package/dist/numbers.d.ts
CHANGED
|
@@ -1,46 +1,96 @@
|
|
|
1
1
|
import { BigNumber } from './classes';
|
|
2
|
+
/**
|
|
3
|
+
* On chain amounts queried from a sentry using the
|
|
4
|
+
* gRPC API are returned with an extra decimal point
|
|
5
|
+
* 18 places from the beginning, so we need to remove it
|
|
6
|
+
* to get a workable amount
|
|
7
|
+
*/
|
|
2
8
|
export declare const denomAmountFromGrpcChainDenomAmount: (value: string | number | BigNumber) => BigNumber;
|
|
9
|
+
/**
|
|
10
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
11
|
+
* where x is a human readable number
|
|
12
|
+
*/
|
|
3
13
|
export declare const denomAmountToChainDenomAmount: ({ value, decimals, }: {
|
|
4
14
|
value: number | string | BigNumber;
|
|
5
15
|
decimals?: string | number | undefined;
|
|
6
|
-
}) =>
|
|
16
|
+
}) => BigNumber;
|
|
17
|
+
/**
|
|
18
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
19
|
+
* where x is a human readable number
|
|
20
|
+
*/
|
|
7
21
|
export declare const denomAmountFromChainDenomAmount: ({ value, decimals, }: {
|
|
8
22
|
value: number | string | BigNumber;
|
|
9
23
|
decimals?: string | number | undefined;
|
|
10
|
-
}) =>
|
|
24
|
+
}) => BigNumber;
|
|
25
|
+
/**
|
|
26
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
27
|
+
* where x is a human readable number
|
|
28
|
+
*/
|
|
11
29
|
export declare const derivativeMarginToChainMargin: ({ value, quoteDecimals, }: {
|
|
12
30
|
value: number | string | BigNumber;
|
|
13
31
|
quoteDecimals?: string | number | undefined;
|
|
14
|
-
}) =>
|
|
32
|
+
}) => BigNumber;
|
|
33
|
+
/**
|
|
34
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
35
|
+
* where x is a human readable number
|
|
36
|
+
*/
|
|
15
37
|
export declare const derivativeMarginFromChainMargin: ({ value, quoteDecimals, }: {
|
|
16
38
|
value: number | string | BigNumber;
|
|
17
39
|
quoteDecimals?: string | number | undefined;
|
|
18
|
-
}) =>
|
|
40
|
+
}) => BigNumber;
|
|
41
|
+
/**
|
|
42
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
43
|
+
* where x is a human readable number
|
|
44
|
+
*/
|
|
19
45
|
export declare const derivativePriceToChainPrice: ({ value, quoteDecimals, }: {
|
|
20
46
|
value: number | string | BigNumber;
|
|
21
47
|
quoteDecimals?: string | number | undefined;
|
|
22
|
-
}) =>
|
|
48
|
+
}) => BigNumber;
|
|
49
|
+
/**
|
|
50
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
51
|
+
* where x is a human readable number
|
|
52
|
+
*/
|
|
23
53
|
export declare const derivativePriceFromChainPrice: ({ value, quoteDecimals, }: {
|
|
24
54
|
value: number | string | BigNumber;
|
|
25
55
|
quoteDecimals?: string | number | undefined;
|
|
26
|
-
}) =>
|
|
56
|
+
}) => BigNumber;
|
|
57
|
+
/**
|
|
58
|
+
* Amount that the chain requires is in the x format
|
|
59
|
+
* where x is a human readable number
|
|
60
|
+
*/
|
|
27
61
|
export declare const derivativeQuantityToChainQuantity: (value: number | string | BigNumber) => BigNumber;
|
|
62
|
+
/**
|
|
63
|
+
* Amount that the chain requires is in the x / 10^(quoteDecimals - baseDecimals) format
|
|
64
|
+
* where x is a human readable number
|
|
65
|
+
*/
|
|
28
66
|
export declare const spotPriceToChainPrice: ({ value, baseDecimals, quoteDecimals, }: {
|
|
29
67
|
value: number | string | BigNumber;
|
|
30
68
|
quoteDecimals?: string | number | undefined;
|
|
31
69
|
baseDecimals?: string | number | undefined;
|
|
32
|
-
}) =>
|
|
70
|
+
}) => BigNumber;
|
|
71
|
+
/**
|
|
72
|
+
* Amount that the chain returns is in the x / 10^(quoteDecimals - baseDecimals) format
|
|
73
|
+
* where x is a human readable number
|
|
74
|
+
*/
|
|
33
75
|
export declare const spotPriceFromChainPrice: ({ value, baseDecimals, quoteDecimals, }: {
|
|
34
76
|
value: number | string | BigNumber;
|
|
35
77
|
quoteDecimals?: string | number | undefined;
|
|
36
78
|
baseDecimals?: string | number | undefined;
|
|
37
|
-
}) =>
|
|
79
|
+
}) => BigNumber;
|
|
80
|
+
/**
|
|
81
|
+
* Amount that the chain requires is in the x * 10^(baseDecimals) format
|
|
82
|
+
* where x is a human readable number
|
|
83
|
+
*/
|
|
38
84
|
export declare const spotQuantityToChainQuantity: ({ value, baseDecimals, }: {
|
|
39
85
|
value: number | string | BigNumber;
|
|
40
86
|
baseDecimals?: string | number | undefined;
|
|
41
|
-
}) =>
|
|
87
|
+
}) => BigNumber;
|
|
88
|
+
/**
|
|
89
|
+
* Amount that the chain returns is in the x * 10^(baseDecimals) format
|
|
90
|
+
* where x is a human readable number
|
|
91
|
+
*/
|
|
42
92
|
export declare const spotQuantityFromChainQuantity: ({ value, baseDecimals, }: {
|
|
43
93
|
value: number | string | BigNumber;
|
|
44
94
|
baseDecimals?: string | number | undefined;
|
|
45
|
-
}) =>
|
|
95
|
+
}) => BigNumber;
|
|
46
96
|
//# sourceMappingURL=numbers.d.ts.map
|
package/dist/numbers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["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AO,MAAM,6BAA6B;WAIjC,MAAM,GAAG,MAAM,GAAG,SAAS;;eAEwC,CAAA"}
|
package/dist/numbers.js
CHANGED
|
@@ -2,48 +2,78 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.spotQuantityFromChainQuantity = exports.spotQuantityToChainQuantity = exports.spotPriceFromChainPrice = exports.spotPriceToChainPrice = exports.derivativeQuantityToChainQuantity = exports.derivativePriceFromChainPrice = exports.derivativePriceToChainPrice = exports.derivativeMarginFromChainMargin = exports.derivativeMarginToChainMargin = exports.denomAmountFromChainDenomAmount = exports.denomAmountToChainDenomAmount = exports.denomAmountFromGrpcChainDenomAmount = void 0;
|
|
4
4
|
const classes_1 = require("./classes");
|
|
5
|
+
/**
|
|
6
|
+
* On chain amounts queried from a sentry using the
|
|
7
|
+
* gRPC API are returned with an extra decimal point
|
|
8
|
+
* 18 places from the beginning, so we need to remove it
|
|
9
|
+
* to get a workable amount
|
|
10
|
+
*/
|
|
5
11
|
const denomAmountFromGrpcChainDenomAmount = (value) => new classes_1.BigNumber(value).dividedBy(new classes_1.BigNumber(10).pow(18));
|
|
6
12
|
exports.denomAmountFromGrpcChainDenomAmount = denomAmountFromGrpcChainDenomAmount;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
15
|
+
* where x is a human readable number
|
|
16
|
+
*/
|
|
17
|
+
const denomAmountToChainDenomAmount = ({ value, decimals = 18, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(decimals));
|
|
10
18
|
exports.denomAmountToChainDenomAmount = denomAmountToChainDenomAmount;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
21
|
+
* where x is a human readable number
|
|
22
|
+
*/
|
|
23
|
+
const denomAmountFromChainDenomAmount = ({ value, decimals = 18, }) => new classes_1.BigNumber(value).dividedBy(new classes_1.BigNumber(10).pow(decimals));
|
|
14
24
|
exports.denomAmountFromChainDenomAmount = denomAmountFromChainDenomAmount;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
27
|
+
* where x is a human readable number
|
|
28
|
+
*/
|
|
29
|
+
const derivativeMarginToChainMargin = ({ value, quoteDecimals = 18, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(quoteDecimals));
|
|
18
30
|
exports.derivativeMarginToChainMargin = derivativeMarginToChainMargin;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
33
|
+
* where x is a human readable number
|
|
34
|
+
*/
|
|
35
|
+
const derivativeMarginFromChainMargin = ({ value, quoteDecimals = 18, }) => new classes_1.BigNumber(value).dividedBy(new classes_1.BigNumber(10).pow(quoteDecimals));
|
|
22
36
|
exports.derivativeMarginFromChainMargin = derivativeMarginFromChainMargin;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Amount that the chain requires is in the x * 10^(quoteDecimals) format
|
|
39
|
+
* where x is a human readable number
|
|
40
|
+
*/
|
|
41
|
+
const derivativePriceToChainPrice = ({ value, quoteDecimals = 18, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(quoteDecimals));
|
|
26
42
|
exports.derivativePriceToChainPrice = derivativePriceToChainPrice;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Amount that the chain returns is in the x * 10^(quoteDecimals) format
|
|
45
|
+
* where x is a human readable number
|
|
46
|
+
*/
|
|
47
|
+
const derivativePriceFromChainPrice = ({ value, quoteDecimals = 18, }) => new classes_1.BigNumber(value).dividedBy(new classes_1.BigNumber(10).pow(quoteDecimals));
|
|
30
48
|
exports.derivativePriceFromChainPrice = derivativePriceFromChainPrice;
|
|
49
|
+
/**
|
|
50
|
+
* Amount that the chain requires is in the x format
|
|
51
|
+
* where x is a human readable number
|
|
52
|
+
*/
|
|
31
53
|
const derivativeQuantityToChainQuantity = (value) => new classes_1.BigNumber(value);
|
|
32
54
|
exports.derivativeQuantityToChainQuantity = derivativeQuantityToChainQuantity;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Amount that the chain requires is in the x / 10^(quoteDecimals - baseDecimals) format
|
|
57
|
+
* where x is a human readable number
|
|
58
|
+
*/
|
|
59
|
+
const spotPriceToChainPrice = ({ value, baseDecimals = 18, quoteDecimals = 6, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(new classes_1.BigNumber(quoteDecimals).minus(baseDecimals)));
|
|
36
60
|
exports.spotPriceToChainPrice = spotPriceToChainPrice;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Amount that the chain returns is in the x / 10^(quoteDecimals - baseDecimals) format
|
|
63
|
+
* where x is a human readable number
|
|
64
|
+
*/
|
|
65
|
+
const spotPriceFromChainPrice = ({ value, baseDecimals = 18, quoteDecimals = 6, }) => new classes_1.BigNumber(value).dividedBy(new classes_1.BigNumber(10).pow(new classes_1.BigNumber(quoteDecimals).minus(baseDecimals)));
|
|
40
66
|
exports.spotPriceFromChainPrice = spotPriceFromChainPrice;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Amount that the chain requires is in the x * 10^(baseDecimals) format
|
|
69
|
+
* where x is a human readable number
|
|
70
|
+
*/
|
|
71
|
+
const spotQuantityToChainQuantity = ({ value, baseDecimals = 18, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(baseDecimals));
|
|
44
72
|
exports.spotQuantityToChainQuantity = spotQuantityToChainQuantity;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Amount that the chain returns is in the x * 10^(baseDecimals) format
|
|
75
|
+
* where x is a human readable number
|
|
76
|
+
*/
|
|
77
|
+
const spotQuantityFromChainQuantity = ({ value, baseDecimals = 18, }) => new classes_1.BigNumber(value).multipliedBy(new classes_1.BigNumber(10).pow(baseDecimals));
|
|
48
78
|
exports.spotQuantityFromChainQuantity = spotQuantityFromChainQuantity;
|
|
49
79
|
//# sourceMappingURL=numbers.js.map
|
package/dist/numbers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../src/numbers.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;
|
|
1
|
+
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../src/numbers.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAErC;;;;;GAKG;AACI,MAAM,mCAAmC,GAAG,CACjD,KAAkC,EAClC,EAAE,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,mBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AAFjD,QAAA,mCAAmC,uCAEc;AAE9D;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,EAC5C,KAAK,EACL,QAAQ,GAAG,EAAE,GAId,EAAE,EAAE,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,IAAI,mBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;AAN3D,QAAA,6BAA6B,iCAM8B;AAExE;;;GAGG;AACI,MAAM,+BAA+B,GAAG,CAAC,EAC9C,KAAK,EACL,QAAQ,GAAG,EAAE,GAId,EAAE,EAAE,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,IA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iCAMkC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/utils",
|
|
3
3
|
"description": "List of utils and helper functions that can be reused throughout Injective's projects.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.56",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"shx": "^0.3.2",
|
|
36
36
|
"store2": "^2.12.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fb71ba9559719bf67a73881e268a5b3cbdeb9fa3"
|
|
39
39
|
}
|