@injectivelabs/sdk-ts 1.17.4 → 1.17.6
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/cjs/{AbacusGrpcApi-BSFhRFgK.cjs → AbacusGrpcApi-QbGB8ZMB.cjs} +1 -1
- package/dist/cjs/{BaseGrpcConsumer-B_mvIpmK.cjs → BaseGrpcConsumer-Db3sCC6b.cjs} +1 -1
- package/dist/cjs/{BaseIndexerGrpcConsumer-DRpriWCr.cjs → BaseIndexerGrpcConsumer-BBXxg_BR.cjs} +1 -1
- package/dist/cjs/{ChainGrpcExchangeApi-6SEFLrhR.cjs → ChainGrpcExchangeApi-Xtflr7xp.cjs} +3 -3
- package/dist/cjs/{ChainRestTendermintApi-B2934YcX.cjs → ChainRestTendermintApi-CyeoAmer.cjs} +3 -3
- package/dist/cjs/{DirectEthSecp256k1Wallet-CIdxvYjL.cjs → DirectEthSecp256k1Wallet-BiAOoEd6.cjs} +2 -2
- package/dist/cjs/{ExecArgNeptuneWithdraw-C-NQ72VM.cjs → ExecArgNeptuneWithdraw-4esQ6Su-.cjs} +2 -2
- package/dist/cjs/{IndexerGrpcWeb3GwApi-DzqoC5Jw.cjs → IndexerGrpcWeb3GwApi-BxJoq1-k.cjs} +2 -2
- package/dist/cjs/{MsgSetDenomMetadata-CJFO-LDN.cjs → MsgSetDenomMetadata-DzYvKtNj.cjs} +5 -5
- package/dist/cjs/{OLPGrpcApi-REqBM4Dt.cjs → OLPGrpcApi-CoVqLaSC.cjs} +108 -107
- package/dist/cjs/{QueryTradingStrategyContractTotalStrategies-BWV29f7F.cjs → QueryTradingStrategyContractTotalStrategies-DPrIH5Jb.cjs} +3 -3
- package/dist/cjs/{StreamManagerV2-BFB78KPn.cjs → StreamManagerV2-Dvfpwi5Z.cjs} +6 -6
- package/dist/cjs/{accounts-CHKUxDIf.cjs → accounts-HFzAaFRB.cjs} +2 -2
- package/dist/cjs/{chain-CtjB0xod.cjs → chain-CPs0kwL0.cjs} +12 -13
- package/dist/cjs/client/abacus.cjs +3 -3
- package/dist/cjs/client/chain.cjs +7 -8
- package/dist/cjs/client/chain.d.cts +2 -2
- package/dist/cjs/client/indexer.cjs +8 -9
- package/dist/cjs/client/indexer.d.cts +2 -2
- package/dist/cjs/client/olp.cjs +4 -5
- package/dist/cjs/client/olp.d.cts +1 -1
- package/dist/cjs/client/wasm.cjs +10 -11
- package/dist/cjs/core/accounts.cjs +4 -5
- package/dist/cjs/core/accounts.d.cts +2 -2
- package/dist/cjs/core/modules.cjs +13 -14
- package/dist/cjs/core/modules.d.cts +2 -2
- package/dist/cjs/core/tx.cjs +10 -11
- package/dist/cjs/core/tx.d.cts +2 -2
- package/dist/cjs/cosmjs.cjs +11 -12
- package/dist/cjs/exports.cjs +11 -12
- package/dist/cjs/{index-B3Hd6YoY.d.cts → index-Bobbl6ef.d.cts} +650 -433
- package/dist/cjs/{index-Be2xjcqA.d.cts → index-Dz6elmkG.d.cts} +1 -1
- package/dist/cjs/index.cjs +25 -26
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/{service-BCLvTVy_.cjs → service-C0DSVBn_.cjs} +2 -2
- package/dist/cjs/service.cjs +4 -5
- package/dist/cjs/{tx-BXn3eqwi.cjs → tx-MgHAjEie.cjs} +5 -5
- package/dist/cjs/types.cjs +1 -1
- package/dist/cjs/{utils-CDl812vv.cjs → utils-D3XFGv8y.cjs} +73 -0
- package/dist/cjs/utils.cjs +7 -8
- package/dist/cjs/utils.d.cts +2 -2
- package/dist/esm/{AbacusGrpcApi-Ccjmvton.js → AbacusGrpcApi-H-P0UiPh.js} +1 -1
- package/dist/esm/{BaseGrpcConsumer-D3CPxlPN.js → BaseGrpcConsumer-a7fB9A_e.js} +1 -1
- package/dist/esm/{BaseGrpcConsumer-CBQRoq72.d.ts → BaseGrpcConsumer-iOh57BsK.d.ts} +1 -1
- package/dist/esm/{BaseIndexerGrpcConsumer-DQUmeane.js → BaseIndexerGrpcConsumer-CrwqSxDq.js} +1 -1
- package/dist/esm/{ChainGrpcExchangeApi-DQvLWB5R.js → ChainGrpcExchangeApi-Ko7rM6Df.js} +3 -3
- package/dist/esm/{ChainRestTendermintApi-DUK7FvxW.js → ChainRestTendermintApi-BUV-cxVj.js} +3 -3
- package/dist/esm/{DirectEthSecp256k1Wallet-BqxC1b40.js → DirectEthSecp256k1Wallet-CMxBvSTE.js} +2 -2
- package/dist/esm/{ExecArgNeptuneWithdraw-uLf3HttI.js → ExecArgNeptuneWithdraw-BRJZq8Vb.js} +2 -2
- package/dist/esm/{IndexerGrpcWeb3GwApi-yHniiZ22.js → IndexerGrpcWeb3GwApi-CX4ohUOk.js} +2 -2
- package/dist/esm/{MsgSetDenomMetadata-BNYIha2C.js → MsgSetDenomMetadata-CeD0R82a.js} +5 -5
- package/dist/esm/{OLPGrpcApi-8NQqfKhT.js → OLPGrpcApi-CX-m2wvC.js} +96 -95
- package/dist/esm/{QueryTradingStrategyContractTotalStrategies-D_4tvQEy.js → QueryTradingStrategyContractTotalStrategies-D9fMELJH.js} +3 -3
- package/dist/esm/{StreamManagerV2-BId1leA1.js → StreamManagerV2-B_6ctbMb.js} +6 -6
- package/dist/esm/{accounts-C5HEaz0B.js → accounts-CP_DVUou.js} +2 -2
- package/dist/esm/{chain-DKislBAW.js → chain-CQczt2h3.js} +4 -5
- package/dist/esm/client/abacus.d.ts +3 -3
- package/dist/esm/client/abacus.js +3 -3
- package/dist/esm/client/chain.d.ts +7 -7
- package/dist/esm/client/chain.js +7 -8
- package/dist/esm/client/indexer.d.ts +7 -7
- package/dist/esm/client/indexer.js +8 -9
- package/dist/esm/client/olp.d.ts +3 -3
- package/dist/esm/client/olp.js +4 -5
- package/dist/esm/client/wasm.d.ts +2 -2
- package/dist/esm/client/wasm.js +10 -11
- package/dist/esm/core/accounts.d.ts +7 -7
- package/dist/esm/core/accounts.js +4 -5
- package/dist/esm/core/modules.d.ts +7 -7
- package/dist/esm/core/modules.js +13 -14
- package/dist/esm/core/tx.d.ts +7 -7
- package/dist/esm/core/tx.js +10 -11
- package/dist/esm/cosmjs.d.ts +1 -1
- package/dist/esm/cosmjs.js +11 -12
- package/dist/esm/exports.d.ts +1 -1
- package/dist/esm/exports.js +11 -12
- package/dist/esm/{index-BhVscuMR.d.ts → index-BMGcJt4Z.d.ts} +651 -434
- package/dist/esm/{index-Dh15HnVF.d.ts → index-BbVYW9Fg.d.ts} +1 -1
- package/dist/esm/{index-D-DmLuDM.d.ts → index-CvTpnDXx.d.ts} +4 -4
- package/dist/esm/{index-BhybypN9.d.ts → index-VRG59FQR.d.ts} +1 -1
- package/dist/esm/{index-DpjBqbbT.d.ts → index-m9_e257q.d.ts} +1 -1
- package/dist/esm/index.d.ts +7 -7
- package/dist/esm/index.js +20 -21
- package/dist/esm/{service-CnqMmybI.js → service-CqKPnKgb.js} +2 -2
- package/dist/esm/service.d.ts +2 -2
- package/dist/esm/service.js +4 -5
- package/dist/esm/{tx-D0NTtgOO.js → tx-ZGcAWTaC.js} +5 -5
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/{utils-BFBu_LnJ.js → utils-CewUFGKA.js} +45 -2
- package/dist/esm/utils.d.ts +7 -7
- package/dist/esm/utils.js +2 -3
- package/package.json +6 -6
- package/dist/cjs/time-B4xLc27Y.cjs +0 -76
- package/dist/esm/time-DYEqYFao.js +0 -46
- /package/dist/cjs/{BaseRestConsumer-uSzCOit7.cjs → BaseRestConsumer-CRkyjiSo.cjs} +0 -0
- /package/dist/cjs/{MsgBase-DqOmzCyS.cjs → MsgBase-D_1CCpXQ.cjs} +0 -0
- /package/dist/cjs/{grpc-DQDVCGpY.cjs → grpc-FG2z-ICE.cjs} +0 -0
- /package/dist/cjs/{types-BTuy007B.cjs → types-BSrt7JzM.cjs} +0 -0
- /package/dist/esm/{BaseRestConsumer-rK4eS4W8.js → BaseRestConsumer-DTvorEHL.js} +0 -0
- /package/dist/esm/{MsgBase-BkRgVbdY.js → MsgBase-D4pO6org.js} +0 -0
- /package/dist/esm/{grpc-lYZqzL0k.js → grpc-C3eJiY2o.js} +0 -0
- /package/dist/esm/{index-BVWIwmli.d.ts → index-B3d3VkdN.d.ts} +0 -0
- /package/dist/esm/{index-BqYLsIZe.d.ts → index-RFPnFBbK.d.ts} +0 -0
- /package/dist/esm/{types-68OuBiEQ.js → types-Cf4oVv93.js} +0 -0
package/dist/esm/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { $ as isNumber, $t as
|
|
2
|
-
import {
|
|
3
|
-
import { n as getGrpcWebTransport, t as GrpcWebFetchTransport } from "./grpc-lYZqzL0k.js";
|
|
1
|
+
import { $ as isNumber, $t as uint8ArrayToString, A as denomAmountToChainDenomAmountToFixed, At as protobufTimestampToUnixMs, B as derivativeQuantityFromChainQuantity, Bt as base64ToUtf8, C as getSpotMarketTensMultiplier, Ct as sha256, D as denomAmountFromChainDenomAmountToFixed, Dt as makeTimeoutTimestamp, E as denomAmountFromChainDenomAmount, Et as getGasPriceBasedOnMessage, F as derivativeMarginToChainMarginToFixed, Ft as BECH32_PUBKEY_ACC_PREFIX, G as formatAmountToAllowableDecimals, Gt as hexToBase64, H as derivativeQuantityToChainQuantity, Ht as concatUint8Arrays, I as derivativePriceFromChainPrice, It as BECH32_PUBKEY_CONS_PREFIX, J as formatPriceToAllowableDecimals, Jt as stringToUint8Array, K as formatNumberToAllowableDecimals, Kt as hexToBuff, L as derivativePriceFromChainPriceToFixed, Lt as BECH32_PUBKEY_VAL_PREFIX, M as derivativeMarginFromChainMargin, Mt as BECH32_ADDR_ACC_PREFIX, N as derivativeMarginFromChainMarginToFixed, Nt as BECH32_ADDR_CONS_PREFIX, O as denomAmountFromGrpcChainDenomAmount, Ot as makeTimeoutTimestampInNs, P as derivativeMarginToChainMargin, Pt as BECH32_ADDR_VAL_PREFIX, Q as getTensMultiplier, Qt as uint8ArrayToHex, R as derivativePriceToChainPrice, Rt as DEFAULT_DERIVATION_PATH, S as getSpotMarketDecimals, St as sanitizeTypedData, T as cosmosSdkDecToBigNumber, Tt as ofacList, U as derivativeQuantityToChainQuantityToFixed, Ut as fromBase64, V as derivativeQuantityFromChainQuantityToFixed, Vt as binaryToBase64, W as formatAmountToAllowableAmount, Wt as fromUtf8, X as getExactDecimalsFromNumber, Xt as toUtf8, Y as formatPriceToAllowablePrice, Yt as toBase64, Z as getSignificantDecimalsFromNumber, Zt as uint8ArrayToBase64, _ as getSubaccountId, _t as privateKeyHashToPublicKeyBase64, a as grpcPagingToPagingV2, an as hexToNumber, at as spotQuantityFromChainQuantity, b as getDerivativeMarketDecimals, bt as publicKeyToAddress, c as paginationUint8ArrayToString, cn as isNode, ct as spotQuantityToChainQuantityToFixed, d as getAddressFromInjectiveAddress, dn as objectToJson, dt as TypedDataUtilsSanitizeData, en as bigIntReplacer, et as numberToCosmosSdkDecString, f as getChecksumAddress, fn as protoObjectToJson, ft as decompressPubKey, g as getInjectiveAddressFromSubaccountId, gt as privateKeyHashToPublicKey, h as getInjectiveAddress, hn as sortObjectByKeysWithReduce, ht as messageHash, i as grpcPagingToPaging, in as grpcCoinToUiCoin, it as spotPriceToChainPriceToFixed, j as denomAmountToGrpcChainDenomAmount, jt as protobufTimestampToUnixSeconds, k as denomAmountToChainDenomAmount, kt as protobufTimestampToDate, ln as isReactNative, lt as SignTypedDataVersionV4, m as getEthereumAddress, mn as sortObjectByKeys, mt as hashToHex, n as fetchAllWithPagination, nn as bigIntToString, nt as spotPriceFromChainPriceToFixed, o as pageRequestToGrpcPageRequestV2, on as isBrowser, ot as spotQuantityFromChainQuantityToFixed, p as getDefaultSubaccountId, pn as safeBigIntStringify, pt as domainHash, q as formatNumberToAllowableTensMultiplier, qt as hexToUint8Array, r as grpcPaginationToPagination, rn as getErrorMessage, rt as spotPriceToChainPrice, s as paginationRequestFromPagination, sn as isJsonString, st as spotQuantityToChainQuantity, t as recoverTypedSignaturePubKey, tn as bigIntToNumber, tt as spotPriceFromChainPrice, u as addHexPrefix, un as isServerSide, ut as TypedDataUtilsHashStruct, v as isCw20ContractAddress, vt as privateKeyToPublicKey, w as amountToCosmosSdkDecAmount, wt as parseCoins, x as getDerivativeMarketTensMultiplier, xt as ripemd160, y as removeHexPrefix, yt as privateKeyToPublicKeyBase64, z as derivativePriceToChainPriceToFixed, zt as base64ToUint8Array } from "./utils-CewUFGKA.js";
|
|
2
|
+
import { n as getGrpcWebTransport, t as GrpcWebFetchTransport } from "./grpc-C3eJiY2o.js";
|
|
4
3
|
|
|
5
4
|
export { BECH32_ADDR_ACC_PREFIX, BECH32_ADDR_CONS_PREFIX, BECH32_ADDR_VAL_PREFIX, BECH32_PUBKEY_ACC_PREFIX, BECH32_PUBKEY_CONS_PREFIX, BECH32_PUBKEY_VAL_PREFIX, DEFAULT_DERIVATION_PATH, GrpcWebFetchTransport, SignTypedDataVersionV4, TypedDataUtilsHashStruct, TypedDataUtilsSanitizeData, addHexPrefix, amountToCosmosSdkDecAmount, base64ToUint8Array, base64ToUtf8, bigIntReplacer, bigIntToNumber, bigIntToString, binaryToBase64, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, formatAmountToAllowableAmount, formatAmountToAllowableDecimals, formatNumberToAllowableDecimals, formatNumberToAllowableTensMultiplier, formatPriceToAllowableDecimals, formatPriceToAllowablePrice, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getChecksumAddress, getDefaultSubaccountId, getDerivativeMarketDecimals, getDerivativeMarketTensMultiplier, getErrorMessage, getEthereumAddress, getExactDecimalsFromNumber, getGasPriceBasedOnMessage, getGrpcWebTransport, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSignificantDecimalsFromNumber, getSpotMarketDecimals, getSpotMarketTensMultiplier, getSubaccountId, getTensMultiplier, grpcCoinToUiCoin, grpcPaginationToPagination, grpcPagingToPaging, grpcPagingToPagingV2, hashToHex, hexToBase64, hexToBuff, hexToNumber, hexToUint8Array, isBrowser, isCw20ContractAddress, isJsonString, isNode, isNumber, isReactNative, isServerSide, makeTimeoutTimestamp, makeTimeoutTimestampInNs, messageHash, numberToCosmosSdkDecString, objectToJson, ofacList, pageRequestToGrpcPageRequestV2, paginationRequestFromPagination, paginationUint8ArrayToString, parseCoins, privateKeyHashToPublicKey, privateKeyHashToPublicKeyBase64, privateKeyToPublicKey, privateKeyToPublicKeyBase64, protoObjectToJson, protobufTimestampToDate, protobufTimestampToUnixMs, protobufTimestampToUnixSeconds, publicKeyToAddress, recoverTypedSignaturePubKey, removeHexPrefix, ripemd160, safeBigIntStringify, sanitizeTypedData, sha256, sortObjectByKeys, sortObjectByKeysWithReduce, spotPriceFromChainPrice, spotPriceFromChainPriceToFixed, spotPriceToChainPrice, spotPriceToChainPriceToFixed, spotQuantityFromChainQuantity, spotQuantityFromChainQuantityToFixed, spotQuantityToChainQuantity, spotQuantityToChainQuantityToFixed, stringToUint8Array, toBase64, toUtf8, uint8ArrayToBase64, uint8ArrayToHex, uint8ArrayToString };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/sdk-ts",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.6",
|
|
4
4
|
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
|
|
314
314
|
"@injectivelabs/indexer-proto-ts-v2": "1.17.6",
|
|
315
315
|
"@injectivelabs/mito-proto-ts-v2": "1.17.3",
|
|
316
|
-
"@injectivelabs/olp-proto-ts-v2": "1.17.
|
|
316
|
+
"@injectivelabs/olp-proto-ts-v2": "1.17.6",
|
|
317
317
|
"@noble/curves": "^1.9.0",
|
|
318
318
|
"@noble/hashes": "^1.8.0",
|
|
319
319
|
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
|
@@ -329,10 +329,10 @@
|
|
|
329
329
|
"rxjs": "7.8.2",
|
|
330
330
|
"snakecase-keys": "^5.4.1",
|
|
331
331
|
"viem": "^2.41.2",
|
|
332
|
-
"@injectivelabs/
|
|
333
|
-
"@injectivelabs/
|
|
334
|
-
"@injectivelabs/
|
|
335
|
-
"@injectivelabs/
|
|
332
|
+
"@injectivelabs/exceptions": "1.17.6",
|
|
333
|
+
"@injectivelabs/networks": "1.17.6",
|
|
334
|
+
"@injectivelabs/ts-types": "1.17.6",
|
|
335
|
+
"@injectivelabs/utils": "1.17.6"
|
|
336
336
|
},
|
|
337
337
|
"publishConfig": {
|
|
338
338
|
"access": "public"
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
3
|
-
|
|
4
|
-
//#region src/utils/time.ts
|
|
5
|
-
/**
|
|
6
|
-
* Returns a timeout timestamp in milliseconds so its compatible
|
|
7
|
-
* with the way Cosmos handles transactions
|
|
8
|
-
*/
|
|
9
|
-
const makeTimeoutTimestamp = (timeoutInMs = __injectivelabs_utils.DEFAULT_TIMESTAMP_TIMEOUT_MS) => {
|
|
10
|
-
const now = /* @__PURE__ */ new Date();
|
|
11
|
-
return new Date(now.getTime() + timeoutInMs).getTime();
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Returns a timeout timestamp in nanoseconds so its compatible
|
|
15
|
-
* with the way Cosmos handles transactions
|
|
16
|
-
*/
|
|
17
|
-
const makeTimeoutTimestampInNs = (timeoutInMs = __injectivelabs_utils.DEFAULT_TIMESTAMP_TIMEOUT_MS) => makeTimeoutTimestamp(timeoutInMs) * 1e6;
|
|
18
|
-
/**
|
|
19
|
-
* Converts a protobuf Timestamp to a JavaScript Date
|
|
20
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
21
|
-
* @returns JavaScript Date or undefined if timestamp is null/undefined
|
|
22
|
-
*/
|
|
23
|
-
const protobufTimestampToDate = (timestamp) => {
|
|
24
|
-
if (!timestamp) return;
|
|
25
|
-
return /* @__PURE__ */ new Date(Number(timestamp.seconds) * 1e3 + Number(timestamp.nanos) / 1e6);
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Converts a protobuf Timestamp to Unix timestamp in seconds
|
|
29
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
30
|
-
* @returns Unix timestamp in seconds or 0 if timestamp is null/undefined
|
|
31
|
-
*/
|
|
32
|
-
const protobufTimestampToUnixSeconds = (timestamp) => {
|
|
33
|
-
if (!timestamp) return 0;
|
|
34
|
-
return Math.floor(Number(timestamp.seconds) + Number(timestamp.nanos) / 1e9);
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Converts a protobuf Timestamp to Unix timestamp in milliseconds
|
|
38
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
39
|
-
* @returns Unix timestamp in milliseconds or 0 if timestamp is null/undefined
|
|
40
|
-
*/
|
|
41
|
-
const protobufTimestampToUnixMs = (timestamp) => {
|
|
42
|
-
if (!timestamp) return 0;
|
|
43
|
-
return Math.floor(Number(timestamp.seconds) * 1e3 + Number(timestamp.nanos) / 1e6);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
Object.defineProperty(exports, 'makeTimeoutTimestamp', {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () {
|
|
50
|
-
return makeTimeoutTimestamp;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(exports, 'makeTimeoutTimestampInNs', {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return makeTimeoutTimestampInNs;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(exports, 'protobufTimestampToDate', {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function () {
|
|
62
|
-
return protobufTimestampToDate;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(exports, 'protobufTimestampToUnixMs', {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return protobufTimestampToUnixMs;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(exports, 'protobufTimestampToUnixSeconds', {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () {
|
|
74
|
-
return protobufTimestampToUnixSeconds;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_TIMESTAMP_TIMEOUT_MS } from "@injectivelabs/utils";
|
|
2
|
-
|
|
3
|
-
//#region src/utils/time.ts
|
|
4
|
-
/**
|
|
5
|
-
* Returns a timeout timestamp in milliseconds so its compatible
|
|
6
|
-
* with the way Cosmos handles transactions
|
|
7
|
-
*/
|
|
8
|
-
const makeTimeoutTimestamp = (timeoutInMs = DEFAULT_TIMESTAMP_TIMEOUT_MS) => {
|
|
9
|
-
const now = /* @__PURE__ */ new Date();
|
|
10
|
-
return new Date(now.getTime() + timeoutInMs).getTime();
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Returns a timeout timestamp in nanoseconds so its compatible
|
|
14
|
-
* with the way Cosmos handles transactions
|
|
15
|
-
*/
|
|
16
|
-
const makeTimeoutTimestampInNs = (timeoutInMs = DEFAULT_TIMESTAMP_TIMEOUT_MS) => makeTimeoutTimestamp(timeoutInMs) * 1e6;
|
|
17
|
-
/**
|
|
18
|
-
* Converts a protobuf Timestamp to a JavaScript Date
|
|
19
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
20
|
-
* @returns JavaScript Date or undefined if timestamp is null/undefined
|
|
21
|
-
*/
|
|
22
|
-
const protobufTimestampToDate = (timestamp) => {
|
|
23
|
-
if (!timestamp) return;
|
|
24
|
-
return /* @__PURE__ */ new Date(Number(timestamp.seconds) * 1e3 + Number(timestamp.nanos) / 1e6);
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Converts a protobuf Timestamp to Unix timestamp in seconds
|
|
28
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
29
|
-
* @returns Unix timestamp in seconds or 0 if timestamp is null/undefined
|
|
30
|
-
*/
|
|
31
|
-
const protobufTimestampToUnixSeconds = (timestamp) => {
|
|
32
|
-
if (!timestamp) return 0;
|
|
33
|
-
return Math.floor(Number(timestamp.seconds) + Number(timestamp.nanos) / 1e9);
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Converts a protobuf Timestamp to Unix timestamp in milliseconds
|
|
37
|
-
* @param timestamp - Protobuf Timestamp object with seconds and nanos fields
|
|
38
|
-
* @returns Unix timestamp in milliseconds or 0 if timestamp is null/undefined
|
|
39
|
-
*/
|
|
40
|
-
const protobufTimestampToUnixMs = (timestamp) => {
|
|
41
|
-
if (!timestamp) return 0;
|
|
42
|
-
return Math.floor(Number(timestamp.seconds) * 1e3 + Number(timestamp.nanos) / 1e6);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
export { protobufTimestampToUnixSeconds as a, protobufTimestampToUnixMs as i, makeTimeoutTimestampInNs as n, protobufTimestampToDate as r, makeTimeoutTimestamp as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|