@injectivelabs/sdk-ts 1.20.51 → 1.20.53
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-DwBUuoqV.cjs → AbacusGrpcApi-DexBiQxy.cjs} +1 -1
- package/dist/cjs/{BaseGrpcConsumer-Ppsh5NLZ.cjs → BaseGrpcConsumer-C1mk2V_9.cjs} +2 -2
- package/dist/cjs/{BaseIndexerGrpcConsumer-BYur8R3D.cjs → BaseIndexerGrpcConsumer-DVa_aYMU.cjs} +1 -1
- package/dist/cjs/{ChainGrpcExchangeApi-Cxcph7iG.cjs → ChainGrpcExchangeApi-CYPPc8yS.cjs} +3 -3
- package/dist/cjs/{ChainRestTendermintApi-lBt4Bo9-.cjs → ChainRestTendermintApi-BfE-2rtB.cjs} +2 -2
- package/dist/cjs/{SocialTradingGrpcApi-UXcBw3hy.cjs → ChartsTradingViewGrpcApi-BYuTrxWO.cjs} +187 -1
- package/dist/cjs/{DirectEthSecp256k1Wallet-DBw-GssU.cjs → DirectEthSecp256k1Wallet-KzazWAat.cjs} +1 -1
- package/dist/cjs/{ExecArgNeptuneWithdraw-DyJyZke3.cjs → ExecArgNeptuneWithdraw-C8xXDAvE.cjs} +2 -2
- package/dist/cjs/{IndexerGrpcWeb3GwApi-Du3x0BEl.cjs → IndexerGrpcWeb3GwApi-CPixqm9l.cjs} +2 -2
- package/dist/cjs/{MsgSetDenomMetadata-CJO2AZPg.cjs → MsgSetDenomMetadata-Bzu3UDR7.cjs} +6 -6
- package/dist/cjs/{OLPGrpcApi-B4Nk34KA.cjs → OLPGrpcApi-DMzqzTp-.cjs} +1 -1
- package/dist/cjs/{QueryTradingStrategyContractTotalStrategies-DKD7pQUB.cjs → QueryTradingStrategyContractTotalStrategies-XOXsMgT9.cjs} +2 -2
- package/dist/cjs/{StreamManagerV2-DRXlho03.cjs → StreamManagerV2-dDz3sHWi.cjs} +5 -5
- package/dist/cjs/{TcAbacusGrpcApi-CozYaZlH.cjs → TcAbacusGrpcApi-By_xt_w-.cjs} +6 -2
- package/dist/cjs/{accounts-Bhuko7RT.cjs → accounts-CEEO_tAS.cjs} +3 -3
- package/dist/cjs/{chain-DFYBhsui.cjs → chain-Vaqb4Vrm.cjs} +4 -4
- package/dist/cjs/client/abacus.cjs +4 -4
- package/dist/cjs/client/chain.cjs +9 -9
- package/dist/cjs/client/chain.d.cts +3 -3
- package/dist/cjs/client/indexer.cjs +9 -9
- package/dist/cjs/client/indexer.d.cts +3 -3
- package/dist/cjs/client/olp.cjs +5 -5
- package/dist/cjs/client/platformServices.cjs +7 -5
- package/dist/cjs/client/platformServices.d.cts +2 -2
- package/dist/cjs/client/tcAbacus.cjs +4 -4
- package/dist/cjs/client/tcAbacus.d.cts +1 -1
- package/dist/cjs/client/wasm.cjs +12 -12
- package/dist/cjs/core/accounts.cjs +7 -6
- package/dist/cjs/core/accounts.d.cts +3 -3
- package/dist/cjs/core/modules.cjs +15 -15
- package/dist/cjs/core/modules.d.cts +3 -3
- package/dist/cjs/core/tx.cjs +12 -12
- package/dist/cjs/core/tx.d.cts +3 -3
- package/dist/cjs/cosmjs.cjs +13 -13
- package/dist/cjs/exports.cjs +13 -13
- package/dist/cjs/{index-Bml8CUoG.d.cts → index-BADdhB_k.d.cts} +405 -2
- package/dist/cjs/{index-BejQEqGF.d.cts → index-CCRCRvKd.d.cts} +6 -2
- package/dist/cjs/{index-BRi1PZdd.d.cts → index-He9ky3uA.d.cts} +19 -1
- package/dist/cjs/index.cjs +28 -24
- package/dist/cjs/index.d.cts +4 -4
- package/dist/cjs/{service-DAfIXxMj.cjs → service-UQHM4Fa_.cjs} +2 -2
- package/dist/cjs/service.cjs +6 -6
- package/dist/cjs/{tx-BbHKcjZg.cjs → tx-DHI9sPwo.cjs} +27 -13
- package/dist/cjs/types/light.cjs +1 -1
- package/dist/cjs/types.cjs +1 -1
- package/dist/cjs/utils/address.cjs +1 -1
- package/dist/cjs/utils/light.cjs +2 -2
- package/dist/cjs/{utils-CIqMZQ2o.cjs → utils-SKHr0NOv.cjs} +96 -0
- package/dist/cjs/utils.cjs +7 -4
- package/dist/cjs/utils.d.cts +4 -4
- package/dist/esm/{AbacusGrpcApi-BIHq_AVs.js → AbacusGrpcApi-CLdXH5bZ.js} +1 -1
- package/dist/esm/{BaseGrpcConsumer-DEDRwnCk.js → BaseGrpcConsumer-B2qNaBaq.js} +2 -2
- package/dist/esm/{BaseIndexerGrpcConsumer-DkRSQkU9.js → BaseIndexerGrpcConsumer-DKboflD4.js} +1 -1
- package/dist/esm/{ChainGrpcExchangeApi-TO68UPsx.js → ChainGrpcExchangeApi-AvCJkW7O.js} +3 -3
- package/dist/esm/{ChainRestTendermintApi-BnJPMbSU.js → ChainRestTendermintApi-CXHeGWjk.js} +2 -2
- package/dist/esm/{SocialTradingGrpcApi-Bax2F760.js → ChartsTradingViewGrpcApi-DDUNU_IX.js} +174 -2
- package/dist/esm/{DirectEthSecp256k1Wallet-D3DNBjSy.js → DirectEthSecp256k1Wallet-X82EheqC.js} +1 -1
- package/dist/esm/{ExecArgNeptuneWithdraw-BM5u-FxH.js → ExecArgNeptuneWithdraw-BzyfMVSe.js} +2 -2
- package/dist/esm/{IndexerGrpcWeb3GwApi-Dzaq-nAM.js → IndexerGrpcWeb3GwApi-DAMdV0I4.js} +2 -2
- package/dist/esm/{MsgSetDenomMetadata-DGzlaIXS.js → MsgSetDenomMetadata-CLenywd3.js} +6 -6
- package/dist/esm/{OLPGrpcApi-BaeWd600.js → OLPGrpcApi-CFbYM2qH.js} +1 -1
- package/dist/esm/{QueryTradingStrategyContractTotalStrategies-B3eiQdnj.js → QueryTradingStrategyContractTotalStrategies-D8-dSDkE.js} +2 -2
- package/dist/esm/{StreamManagerV2-Dnq2AWna.js → StreamManagerV2-DkBlluoc.js} +5 -5
- package/dist/esm/{TcAbacusGrpcApi-g-zwwExV.js → TcAbacusGrpcApi-l8vyZCck.js} +6 -2
- package/dist/esm/{accounts-bOFI_1wE.js → accounts-CSXPhB6W.js} +3 -3
- package/dist/esm/{chain-Jr63sBTP.js → chain-B1k6xknc.js} +4 -4
- package/dist/esm/client/abacus.js +4 -4
- package/dist/esm/client/chain.d.ts +3 -3
- package/dist/esm/client/chain.js +9 -9
- package/dist/esm/client/indexer.d.ts +3 -3
- package/dist/esm/client/indexer.js +9 -9
- package/dist/esm/client/olp.js +5 -5
- package/dist/esm/client/platformServices.d.ts +2 -2
- package/dist/esm/client/platformServices.js +5 -5
- package/dist/esm/client/tcAbacus.d.ts +1 -1
- package/dist/esm/client/tcAbacus.js +4 -4
- package/dist/esm/client/wasm.js +12 -12
- package/dist/esm/core/accounts.d.ts +3 -3
- package/dist/esm/core/accounts.js +7 -6
- package/dist/esm/core/modules.d.ts +3 -3
- package/dist/esm/core/modules.js +15 -15
- package/dist/esm/core/tx.d.ts +3 -3
- package/dist/esm/core/tx.js +12 -12
- package/dist/esm/cosmjs.js +13 -13
- package/dist/esm/exports.js +13 -13
- package/dist/esm/{index-uEknWjpx.d.ts → index-Bq0LFse7.d.ts} +19 -1
- package/dist/esm/{index-DNARB9NC.d.ts → index-D6Zm6NwF.d.ts} +6 -2
- package/dist/esm/{index-tgSyqu1L.d.ts → index-DMei-AO6.d.ts} +405 -2
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +24 -24
- package/dist/esm/{service-ByVrhiMR.js → service-BJtGNIsI.js} +2 -2
- package/dist/esm/service.js +6 -6
- package/dist/esm/{tx-BxMH4W6J.js → tx-CVLB4qip.js} +27 -13
- package/dist/esm/types/light.js +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils/address.js +1 -1
- package/dist/esm/utils/light.js +2 -2
- package/dist/esm/{utils-BvlndkVI.js → utils-gwPCLHN6.js} +85 -1
- package/dist/esm/utils.d.ts +4 -4
- package/dist/esm/utils.js +6 -5
- package/package.json +7 -7
- /package/dist/cjs/{MsgBase-BrhVMws0.cjs → MsgBase-BqZWKNPE.cjs} +0 -0
- /package/dist/cjs/{address-light-C_a6b8yF.cjs → address-light-DUoYqdPQ.cjs} +0 -0
- /package/dist/cjs/{coins-DRrEtaSG.cjs → coins-DBj8089z.cjs} +0 -0
- /package/dist/cjs/{grpc-3Z8ffFdZ.cjs → grpc-D_3PKEFB.cjs} +0 -0
- /package/dist/cjs/{light-CrajlUvd.cjs → light-zeGviAVI.cjs} +0 -0
- /package/dist/esm/{MsgBase-CmMIxNsl.js → MsgBase-BQlZFcm-.js} +0 -0
- /package/dist/esm/{address-light-B2JvY3Or.js → address-light-CwLNB73Y.js} +0 -0
- /package/dist/esm/{coins-MO-ob9NV.js → coins-DTdsvmX2.js} +0 -0
- /package/dist/esm/{grpc-D2EQHGkK.js → grpc-CSo1TcHx.js} +0 -0
- /package/dist/esm/{light-BBrX6IRm.js → light-BUFhVek8.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { f as toUtf8, m as uint8ArrayToHex, p as uint8ArrayToBase64, t as base64ToUint8Array, u as stringToUint8Array } from "./encoding-light-BpntDob-.js";
|
|
2
2
|
import { t as _defineProperty } from "./defineProperty-BwBXXd7t.js";
|
|
3
|
-
import { S as createSignDoc, T as createSigners, b as createFee, n as PrivateKey, t as BaseAccount, v as createAuthInfo, y as createBody } from "./accounts-
|
|
4
|
-
import { At as sortObjectByKeys, Mt as ofacList,
|
|
5
|
-
import { i as ChainGrpcAuthApi, n as ChainRestAuthApi, r as ChainGrpcTendermintApi, t as ChainRestTendermintApi } from "./ChainRestTendermintApi-
|
|
6
|
-
import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-
|
|
7
|
-
import { t as IndexerGrpcWeb3GwApi } from "./IndexerGrpcWeb3GwApi-
|
|
3
|
+
import { S as createSignDoc, T as createSigners, b as createFee, n as PrivateKey, t as BaseAccount, v as createAuthInfo, y as createBody } from "./accounts-CSXPhB6W.js";
|
|
4
|
+
import { At as sortObjectByKeys, Mt as ofacList, Pt as getGasOptionsBasedOnMessage, ot as hashToHex, yt as getErrorMessage } from "./utils-gwPCLHN6.js";
|
|
5
|
+
import { i as ChainGrpcAuthApi, n as ChainRestAuthApi, r as ChainGrpcTendermintApi, t as ChainRestTendermintApi } from "./ChainRestTendermintApi-CXHeGWjk.js";
|
|
6
|
+
import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-B2qNaBaq.js";
|
|
7
|
+
import { t as IndexerGrpcWeb3GwApi } from "./IndexerGrpcWeb3GwApi-DAMdV0I4.js";
|
|
8
8
|
import * as CosmosTxV1Beta1TxPb from "@injectivelabs/core-proto-ts-v2/generated/cosmos/tx/v1beta1/tx_pb";
|
|
9
9
|
import { keccak256 } from "viem";
|
|
10
10
|
import { DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, DEFAULT_TX_POLL_CALL_TIMEOUT_MS, DEFAULT_TX_POLL_INTERVAL_MS, HttpClient, getDefaultStdFee, getStdFee, getStdFeeFromString, sleep, toBigNumber } from "@injectivelabs/utils";
|
|
@@ -1155,6 +1155,7 @@ var MsgBroadcasterWithPk = class {
|
|
|
1155
1155
|
_defineProperty(this, "useRest", false);
|
|
1156
1156
|
_defineProperty(this, "gasBufferCoefficient", 1.1);
|
|
1157
1157
|
_defineProperty(this, "txTimeout", DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
1158
|
+
_defineProperty(this, "useFixedGas", false);
|
|
1158
1159
|
const network = options.network || Network.MainnetSentry;
|
|
1159
1160
|
const networkInfo = getNetworkInfo(network);
|
|
1160
1161
|
const endpoints = getNetworkEndpoints(network);
|
|
@@ -1170,6 +1171,7 @@ var MsgBroadcasterWithPk = class {
|
|
|
1170
1171
|
};
|
|
1171
1172
|
this.privateKey = options.privateKey instanceof PrivateKey ? options.privateKey : PrivateKey.fromHex(options.privateKey);
|
|
1172
1173
|
this.txTimeoutOnFeeDelegation = options.txTimeoutOnFeeDelegation || this.txTimeoutOnFeeDelegation;
|
|
1174
|
+
this.useFixedGas = options.useFixedGas || false;
|
|
1173
1175
|
}
|
|
1174
1176
|
/**
|
|
1175
1177
|
* Broadcasting the transaction using the client
|
|
@@ -1190,7 +1192,8 @@ var MsgBroadcasterWithPk = class {
|
|
|
1190
1192
|
* @returns {string} transaction hash
|
|
1191
1193
|
*/
|
|
1192
1194
|
async broadcastWithFeeDelegation(transaction) {
|
|
1193
|
-
|
|
1195
|
+
var _tx$gas;
|
|
1196
|
+
const { endpoints, txTimeout, privateKey, evmChainId, txTimeoutOnFeeDelegation } = this;
|
|
1194
1197
|
const ethereumWallet = this.privateKey.toHex();
|
|
1195
1198
|
if (ofacList.includes(ethereumWallet)) throw new GeneralException(/* @__PURE__ */ new Error("You cannot execute this transaction"));
|
|
1196
1199
|
const msgs = Array.isArray(transaction.msgs) ? transaction.msgs : [transaction.msgs];
|
|
@@ -1207,13 +1210,19 @@ var MsgBroadcasterWithPk = class {
|
|
|
1207
1210
|
timeoutHeight = toBigNumber(latestHeight.toString()).plus(txTimeout).toNumber();
|
|
1208
1211
|
}
|
|
1209
1212
|
const transactionApi = new IndexerGrpcWeb3GwApi(endpoints.web3gw || endpoints.indexer);
|
|
1213
|
+
const { gasLimit, estimateGas } = getGasOptionsBasedOnMessage({
|
|
1214
|
+
msgs,
|
|
1215
|
+
gas: this.useFixedGas ? (_tx$gas = tx.gas) === null || _tx$gas === void 0 ? void 0 : _tx$gas.gas : void 0,
|
|
1216
|
+
simulateTx: this.simulateTx,
|
|
1217
|
+
useFixedGas: this.useFixedGas
|
|
1218
|
+
});
|
|
1210
1219
|
const txResponse = await transactionApi.prepareTxRequest({
|
|
1211
1220
|
memo: tx.memo,
|
|
1212
1221
|
message: web3Msgs,
|
|
1213
1222
|
address: tx.ethereumAddress,
|
|
1214
1223
|
chainId: evmChainId,
|
|
1215
|
-
gasLimit
|
|
1216
|
-
estimateGas
|
|
1224
|
+
gasLimit,
|
|
1225
|
+
estimateGas,
|
|
1217
1226
|
timeoutHeight
|
|
1218
1227
|
});
|
|
1219
1228
|
const signature = await privateKey.signTypedData(JSON.parse(txResponse.data));
|
|
@@ -1271,10 +1280,10 @@ var MsgBroadcasterWithPk = class {
|
|
|
1271
1280
|
* gas limit based on the simulation and add a small multiplier
|
|
1272
1281
|
* to be safe (factor of 1.1 (or user specified))
|
|
1273
1282
|
*/
|
|
1274
|
-
async getTxWithStdFee(args) {
|
|
1283
|
+
async getTxWithStdFee(args, estimateGas = this.simulateTx) {
|
|
1275
1284
|
var _result$gasInfo;
|
|
1276
|
-
const {
|
|
1277
|
-
if (!
|
|
1285
|
+
const { gasBufferCoefficient } = this;
|
|
1286
|
+
if (!estimateGas) return createTransaction(args);
|
|
1278
1287
|
const result = await this.simulateTxRaw(args);
|
|
1279
1288
|
if (!((_result$gasInfo = result.gasInfo) === null || _result$gasInfo === void 0 ? void 0 : _result$gasInfo.gasUsed)) return createTransaction(args);
|
|
1280
1289
|
const stdGasFee = getStdFee({
|
|
@@ -1308,7 +1317,12 @@ var MsgBroadcasterWithPk = class {
|
|
|
1308
1317
|
const actualAccountDetails = await this.getAccountDetails(accountDetails);
|
|
1309
1318
|
/** Block Details */
|
|
1310
1319
|
const timeoutHeight = await this.getTimeoutHeight();
|
|
1311
|
-
const gas
|
|
1320
|
+
const { gas, estimateGas } = getGasOptionsBasedOnMessage({
|
|
1321
|
+
msgs,
|
|
1322
|
+
gas: (_transaction$gas = transaction.gas) === null || _transaction$gas === void 0 ? void 0 : _transaction$gas.gas,
|
|
1323
|
+
simulateTx: this.simulateTx,
|
|
1324
|
+
useFixedGas: this.useFixedGas
|
|
1325
|
+
});
|
|
1312
1326
|
/** Prepare the Transaction * */
|
|
1313
1327
|
const { signBytes, txRaw } = await this.getTxWithStdFee({
|
|
1314
1328
|
memo: tx.memo || "",
|
|
@@ -1322,7 +1336,7 @@ var MsgBroadcasterWithPk = class {
|
|
|
1322
1336
|
sequence: actualAccountDetails.sequence,
|
|
1323
1337
|
accountNumber: actualAccountDetails.accountNumber,
|
|
1324
1338
|
chainId
|
|
1325
|
-
});
|
|
1339
|
+
}, estimateGas);
|
|
1326
1340
|
/** Append Signatures */
|
|
1327
1341
|
txRaw.signatures = [await privateKey.sign(signBytes)];
|
|
1328
1342
|
return {
|
package/dist/esm/types/light.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as TradeExecutionSide, a as MarketStatusMap, c as OrderSide, d as StreamDisconnectReason, f as StreamEvent, g as TradeDirection, h as TokenVerification, i as GrpcStatusCode, l as OrderState, m as TokenType, n as GrpcMarketStatusMap, o as MarketType, p as StreamOperation, r as GrpcOrderTypeMap, s as OracleTypeMap, t as GridStrategyType, u as OrderTypeMap, v as TradeExecutionType } from "../light-
|
|
1
|
+
import { _ as TradeExecutionSide, a as MarketStatusMap, c as OrderSide, d as StreamDisconnectReason, f as StreamEvent, g as TradeDirection, h as TokenVerification, i as GrpcStatusCode, l as OrderState, m as TokenType, n as GrpcMarketStatusMap, o as MarketType, p as StreamOperation, r as GrpcOrderTypeMap, s as OracleTypeMap, t as GridStrategyType, u as OrderTypeMap, v as TradeExecutionType } from "../light-BUFhVek8.js";
|
|
2
2
|
|
|
3
3
|
export { GridStrategyType, GrpcMarketStatusMap, GrpcOrderTypeMap, GrpcStatusCode, MarketStatusMap, MarketType, OracleTypeMap, OrderSide, OrderState, OrderTypeMap, StreamDisconnectReason, StreamEvent, StreamOperation, TokenType, TokenVerification, TradeDirection, TradeExecutionSide, TradeExecutionType };
|
package/dist/esm/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as TradeExecutionSide, c as OrderSide, d as StreamDisconnectReason, f as StreamEvent, g as TradeDirection, h as TokenVerification, i as GrpcStatusCode, l as OrderState, m as TokenType, p as StreamOperation, v as TradeExecutionType } from "./light-
|
|
1
|
+
import { _ as TradeExecutionSide, c as OrderSide, d as StreamDisconnectReason, f as StreamEvent, g as TradeDirection, h as TokenVerification, i as GrpcStatusCode, l as OrderState, m as TokenType, p as StreamOperation, v as TradeExecutionType } from "./light-BUFhVek8.js";
|
|
2
2
|
import { t as StreamState } from "./stream-AVOxjM-h.js";
|
|
3
3
|
import { n as TokenSource, t as OrderMaskMap } from "./types-CD1KNXoO.js";
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i as getDefaultSubaccountId, l as hexToBytes, n as bytesToHex, o as getInjectiveAddress, r as getAddressFromInjectiveAddress, s as getInjectiveAddressFromSubaccountId, t as addHexPrefix, u as isCw20ContractAddress } from "../address-light-
|
|
1
|
+
import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i as getDefaultSubaccountId, l as hexToBytes, n as bytesToHex, o as getInjectiveAddress, r as getAddressFromInjectiveAddress, s as getInjectiveAddressFromSubaccountId, t as addHexPrefix, u as isCw20ContractAddress } from "../address-light-CwLNB73Y.js";
|
|
2
2
|
|
|
3
3
|
export { addHexPrefix, bytesToHex, getAddressFromInjectiveAddress, getDefaultSubaccountId, getEthereumAddress, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSubaccountId, hexToBytes, isCw20ContractAddress, removeHexPrefix };
|
package/dist/esm/utils/light.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as fromBase64, c as hexToBuff, d as toBase64, f as toUtf8, h as uint8ArrayToString, i as concatUint8Arrays, l as hexToUint8Array, m as uint8ArrayToHex, n as base64ToUtf8, o as fromUtf8, p as uint8ArrayToBase64, r as binaryToBase64, s as hexToBase64, t as base64ToUint8Array, u as stringToUint8Array } from "../encoding-light-BpntDob-.js";
|
|
2
2
|
import { a as BECH32_PUBKEY_CONS_PREFIX, i as BECH32_PUBKEY_ACC_PREFIX, n as BECH32_ADDR_CONS_PREFIX, o as BECH32_PUBKEY_VAL_PREFIX, r as BECH32_ADDR_VAL_PREFIX, s as DEFAULT_DERIVATION_PATH, t as BECH32_ADDR_ACC_PREFIX } from "../constants-J9ftgKqC.js";
|
|
3
|
-
import { t as parseCoins } from "../coins-
|
|
4
|
-
import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i as getDefaultSubaccountId, l as hexToBytes, n as bytesToHex, o as getInjectiveAddress, r as getAddressFromInjectiveAddress, s as getInjectiveAddressFromSubaccountId, t as addHexPrefix, u as isCw20ContractAddress } from "../address-light-
|
|
3
|
+
import { t as parseCoins } from "../coins-DTdsvmX2.js";
|
|
4
|
+
import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i as getDefaultSubaccountId, l as hexToBytes, n as bytesToHex, o as getInjectiveAddress, r as getAddressFromInjectiveAddress, s as getInjectiveAddressFromSubaccountId, t as addHexPrefix, u as isCw20ContractAddress } from "../address-light-CwLNB73Y.js";
|
|
5
5
|
|
|
6
6
|
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, addHexPrefix, base64ToUint8Array, base64ToUtf8, binaryToBase64, bytesToHex, concatUint8Arrays, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getDefaultSubaccountId, getEthereumAddress, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSubaccountId, hexToBase64, hexToBuff, hexToBytes, hexToUint8Array, isCw20ContractAddress, parseCoins, removeHexPrefix, stringToUint8Array, toBase64, toUtf8, uint8ArrayToBase64, uint8ArrayToHex, uint8ArrayToString };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { l as hexToUint8Array, m as uint8ArrayToHex, p as uint8ArrayToBase64, t as base64ToUint8Array } from "./encoding-light-BpntDob-.js";
|
|
2
|
+
import { u as OrderTypeMap } from "./light-BUFhVek8.js";
|
|
2
3
|
import { hashTypedData, keccak256, recoverPublicKey } from "viem";
|
|
3
4
|
import { BigNumber, DEFAULT_EXCHANGE_LIMIT, DEFAULT_GAS_LIMIT, DEFAULT_IBC_GAS_LIMIT, DEFAULT_TIMESTAMP_TIMEOUT_MS, getExactDecimalsFromNumber, getSignificantDecimalsFromNumber, toBigNumber, toChainFormat, toHumanReadable } from "@injectivelabs/utils";
|
|
4
5
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
@@ -50,6 +51,89 @@ const protobufTimestampToUnixMs = (timestamp) => {
|
|
|
50
51
|
|
|
51
52
|
//#endregion
|
|
52
53
|
//#region src/utils/msgs.ts
|
|
54
|
+
const fixedExchangeGas = {
|
|
55
|
+
MsgCreateDerivativeLimitOrder: {
|
|
56
|
+
gas: 33e4,
|
|
57
|
+
postOnlyGas: 37e4,
|
|
58
|
+
hasOrder: true
|
|
59
|
+
},
|
|
60
|
+
MsgCreateDerivativeMarketOrder: {
|
|
61
|
+
gas: 31e4,
|
|
62
|
+
hasOrder: true
|
|
63
|
+
},
|
|
64
|
+
MsgCancelDerivativeOrder: { gas: 2e5 },
|
|
65
|
+
MsgCreateSpotLimitOrder: {
|
|
66
|
+
gas: 3e5,
|
|
67
|
+
postOnlyGas: 33e4,
|
|
68
|
+
hasOrder: true
|
|
69
|
+
},
|
|
70
|
+
MsgCreateSpotMarketOrder: {
|
|
71
|
+
gas: 3e5,
|
|
72
|
+
hasOrder: true
|
|
73
|
+
},
|
|
74
|
+
MsgCancelSpotOrder: { gas: 185e3 },
|
|
75
|
+
MsgCreateBinaryOptionsLimitOrder: {
|
|
76
|
+
gas: 33e4,
|
|
77
|
+
postOnlyGas: 37e4,
|
|
78
|
+
hasOrder: true
|
|
79
|
+
},
|
|
80
|
+
MsgCreateBinaryOptionsMarketOrder: {
|
|
81
|
+
gas: 31e4,
|
|
82
|
+
hasOrder: true
|
|
83
|
+
},
|
|
84
|
+
MsgCancelBinaryOptionsOrder: { gas: 2e5 },
|
|
85
|
+
MsgDeposit: { gas: 33e4 },
|
|
86
|
+
MsgWithdraw: { gas: 32e4 },
|
|
87
|
+
MsgSubaccountTransfer: { gas: 22e4 },
|
|
88
|
+
MsgExternalTransfer: { gas: 3e5 },
|
|
89
|
+
MsgIncreasePositionMargin: { gas: 185e3 },
|
|
90
|
+
MsgDecreasePositionMargin: { gas: 2e5 }
|
|
91
|
+
};
|
|
92
|
+
const fixedExchangeType = /^\/injective\.exchange\.v(?:1beta1|2)\.(Msg\w+)$/;
|
|
93
|
+
const postOnlyOrderTypes = new Set([OrderTypeMap.BUY_PO, OrderTypeMap.SELL_PO]);
|
|
94
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
95
|
+
const getExchangeOrder = (message) => {
|
|
96
|
+
if (!isRecord(message) || !isRecord(message.order)) return;
|
|
97
|
+
const { orderType, expirationBlock } = message.order;
|
|
98
|
+
if (typeof orderType !== "number" || expirationBlock !== void 0 && typeof expirationBlock !== "bigint") return;
|
|
99
|
+
return {
|
|
100
|
+
orderType,
|
|
101
|
+
expirationBlock
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const isFixedExchangeMessage = (messageType) => Object.prototype.hasOwnProperty.call(fixedExchangeGas, messageType);
|
|
105
|
+
const getFixedGasLimitBasedOnMessage = (msgs) => {
|
|
106
|
+
const messages = Array.isArray(msgs) ? msgs : [msgs];
|
|
107
|
+
if (!messages.length) return;
|
|
108
|
+
let gas = 0;
|
|
109
|
+
for (const msg of messages) {
|
|
110
|
+
var _order$expirationBloc;
|
|
111
|
+
const directSign = msg.toDirectSign();
|
|
112
|
+
const match = directSign.type.match(fixedExchangeType);
|
|
113
|
+
const messageType = match === null || match === void 0 ? void 0 : match[1];
|
|
114
|
+
if (!messageType || !isFixedExchangeMessage(messageType)) return;
|
|
115
|
+
const policy = fixedExchangeGas[messageType];
|
|
116
|
+
const order = "hasOrder" in policy ? getExchangeOrder(directSign.message) : void 0;
|
|
117
|
+
if ("hasOrder" in policy && !order) return;
|
|
118
|
+
const baseGas = (order === null || order === void 0 ? void 0 : order.orderType) !== void 0 && postOnlyOrderTypes.has(order.orderType) && "postOnlyGas" in policy ? policy.postOnlyGas : policy.gas;
|
|
119
|
+
const hasExpirationBlock = ((_order$expirationBloc = order === null || order === void 0 ? void 0 : order.expirationBlock) !== null && _order$expirationBloc !== void 0 ? _order$expirationBloc : 0n) > 0n;
|
|
120
|
+
gas += hasExpirationBlock ? baseGas + baseGas / 10 : baseGas;
|
|
121
|
+
}
|
|
122
|
+
return gas;
|
|
123
|
+
};
|
|
124
|
+
const getGasOptionsBasedOnMessage = ({ msgs, gas, simulateTx, useFixedGas = false }) => {
|
|
125
|
+
var _ref;
|
|
126
|
+
const messages = Array.isArray(msgs) ? msgs : [msgs];
|
|
127
|
+
const explicitGas = gas || void 0;
|
|
128
|
+
const fixedGasLimit = useFixedGas && explicitGas === void 0 ? getFixedGasLimitBasedOnMessage(messages) : void 0;
|
|
129
|
+
const gasLimit = (_ref = explicitGas !== null && explicitGas !== void 0 ? explicitGas : fixedGasLimit) !== null && _ref !== void 0 ? _ref : getGasPriceBasedOnMessage(messages);
|
|
130
|
+
const estimateGas = simulateTx && (!useFixedGas || explicitGas === void 0 && fixedGasLimit === void 0);
|
|
131
|
+
return {
|
|
132
|
+
gas: gasLimit.toString(),
|
|
133
|
+
gasLimit,
|
|
134
|
+
estimateGas
|
|
135
|
+
};
|
|
136
|
+
};
|
|
53
137
|
const getGasPriceBasedOnMessage = (msgs) => {
|
|
54
138
|
const messages = Array.isArray(msgs) ? msgs : [msgs];
|
|
55
139
|
const messageType = messages[0].toDirectSign().type;
|
|
@@ -942,4 +1026,4 @@ const recoverTypedSignaturePubKey = async (data, signature) => {
|
|
|
942
1026
|
};
|
|
943
1027
|
|
|
944
1028
|
//#endregion
|
|
945
|
-
export { spotQuantityToChainQuantity as $, derivativePriceToChainPrice as A, sortObjectByKeys as At, formatPriceToAllowableDecimals as B, denomAmountToGrpcChainDenomAmount as C, isJsonString as Ct, derivativeMarginToChainMarginToFixed as D, objectToJson as Dt, derivativeMarginToChainMargin as E, isServerSide as Et, derivativeQuantityToChainQuantityToFixed as F,
|
|
1029
|
+
export { spotQuantityToChainQuantity as $, derivativePriceToChainPrice as A, sortObjectByKeys as At, formatPriceToAllowableDecimals as B, protobufTimestampToUnixSeconds as Bt, denomAmountToGrpcChainDenomAmount as C, isJsonString as Ct, derivativeMarginToChainMarginToFixed as D, objectToJson as Dt, derivativeMarginToChainMargin as E, isServerSide as Et, derivativeQuantityToChainQuantityToFixed as F, getGasPriceBasedOnMessage as Ft, isNumber as G, getExactDecimalsFromNumber as H, formatAmountToAllowableAmount as I, makeTimeoutTimestamp as It, spotPriceFromChainPriceToFixed as J, numberToCosmosSdkDecString as K, formatAmountToAllowableDecimals as L, makeTimeoutTimestampInNs as Lt, derivativeQuantityFromChainQuantity as M, ofacList as Mt, derivativeQuantityFromChainQuantityToFixed as N, getFixedGasLimitBasedOnMessage as Nt, derivativePriceFromChainPrice as O, protoObjectToJson as Ot, derivativeQuantityToChainQuantity as P, getGasOptionsBasedOnMessage as Pt, spotQuantityFromChainQuantityToFixed as Q, formatNumberToAllowableDecimals as R, protobufTimestampToDate as Rt, denomAmountToChainDenomAmountToFixed as S, isBrowser as St, derivativeMarginFromChainMarginToFixed as T, isReactNative as Tt, getSignificantDecimalsFromNumber as U, formatPriceToAllowablePrice as V, getTensMultiplier as W, spotPriceToChainPriceToFixed as X, spotPriceToChainPrice as Y, spotQuantityFromChainQuantity as Z, cosmosSdkDecToBigNumber as _, bigIntToNumber as _t, grpcPagingToPaging as a, domainHash as at, denomAmountFromGrpcChainDenomAmount as b, grpcCoinToUiCoin as bt, paginationRequestFromPagination as c, privateKeyHashToPublicKey as ct, getChecksumAddress as d, privateKeyToPublicKeyBase64 as dt, spotQuantityToChainQuantityToFixed as et, getDerivativeMarketDecimals as f, publicKeyToAddress as ft, amountToCosmosSdkDecAmount as g, bigIntReplacer as gt, getSpotMarketTensMultiplier as h, sha256$1 as ht, grpcPaginationToPagination as i, decompressPubKey as it, derivativePriceToChainPriceToFixed as j, sortObjectByKeysWithReduce as jt, derivativePriceFromChainPriceToFixed as k, safeBigIntStringify as kt, paginationUint8ArrayToString as l, privateKeyHashToPublicKeyBase64 as lt, getSpotMarketDecimals as m, sanitizeTypedData as mt, fetchAllWithPagination as n, TypedDataUtilsHashStruct as nt, grpcPagingToPagingV2 as o, hashToHex as ot, getDerivativeMarketTensMultiplier as p, ripemd160$1 as pt, spotPriceFromChainPrice as q, fetchAllWithTokenPagination as r, TypedDataUtilsSanitizeData as rt, pageRequestToGrpcPageRequestV2 as s, messageHash as st, recoverTypedSignaturePubKey as t, SignTypedDataVersionV4 as tt, ChainGrpcCommonTransformer as u, privateKeyToPublicKey as ut, denomAmountFromChainDenomAmount as v, bigIntToString as vt, derivativeMarginFromChainMargin as w, isNode as wt, denomAmountToChainDenomAmount as x, hexToNumber as xt, denomAmountFromChainDenomAmountToFixed as y, getErrorMessage as yt, formatNumberToAllowableTensMultiplier as z, protobufTimestampToUnixMs as zt };
|
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./tx_pb-Blty6MDM.js";
|
|
2
2
|
import "./index-DErklCLI.js";
|
|
3
3
|
import "./light-BFGvKXwS.js";
|
|
4
|
-
import { $d as derivativeMarginFromChainMargin, $f as messageHash, Af as bigIntReplacer, Bd as getChecksumAddress, Bf as isServerSide, Cf as spotPriceFromChainPriceToFixed, Df as spotQuantityFromChainQuantityToFixed, Ef as spotQuantityFromChainQuantity, Fd as grpcPagingToPaging, Ff as hexToNumber, Gd as amountToCosmosSdkDecAmount, Gf as sortObjectByKeysWithReduce, Hd as getDerivativeMarketTensMultiplier, Hf as protoObjectToJson, Id as grpcPagingToPagingV2, If as isBrowser, Jd as denomAmountFromChainDenomAmountToFixed, Jf as TypedDataUtilsSanitizeData, Kd as cosmosSdkDecToBigNumber, Kf as SignTypedDataVersionV4, Ld as pageRequestToGrpcPageRequestV2, Lf as isJsonString, Md as fetchAllWithPagination, Mf as bigIntToString, Nd as fetchAllWithTokenPagination, Nf as getErrorMessage, Of as spotQuantityToChainQuantity, Pd as grpcPaginationToPagination, Pf as grpcCoinToUiCoin, Qd as denomAmountToGrpcChainDenomAmount, Qf as hashToHex, Rd as paginationRequestFromPagination, Rf as isNode, Sf as spotPriceFromChainPrice, Tf as spotPriceToChainPriceToFixed, Ud as getSpotMarketDecimals, Uf as safeBigIntStringify, Vd as getDerivativeMarketDecimals, Vf as objectToJson, Wd as getSpotMarketTensMultiplier, Wf as sortObjectByKeys, Xd as denomAmountToChainDenomAmount, Xf as decompressPubKey, Yd as denomAmountFromGrpcChainDenomAmount, Yf as TypedMessageV4, Zd as denomAmountToChainDenomAmountToFixed, Zf as domainHash, _f as getExactDecimalsFromNumber,
|
|
4
|
+
import { $d as derivativeMarginFromChainMargin, $f as messageHash, Af as bigIntReplacer, Bd as getChecksumAddress, Bf as isServerSide, Cf as spotPriceFromChainPriceToFixed, Df as spotQuantityFromChainQuantityToFixed, Ef as spotQuantityFromChainQuantity, Fd as grpcPagingToPaging, Ff as hexToNumber, Gd as amountToCosmosSdkDecAmount, Gf as sortObjectByKeysWithReduce, Hd as getDerivativeMarketTensMultiplier, Hf as protoObjectToJson, Id as grpcPagingToPagingV2, If as isBrowser, Jd as denomAmountFromChainDenomAmountToFixed, Jf as TypedDataUtilsSanitizeData, Kd as cosmosSdkDecToBigNumber, Kf as SignTypedDataVersionV4, Ld as pageRequestToGrpcPageRequestV2, Lf as isJsonString, Md as fetchAllWithPagination, Mf as bigIntToString, Nd as fetchAllWithTokenPagination, Nf as getErrorMessage, Of as spotQuantityToChainQuantity, Pd as grpcPaginationToPagination, Pf as grpcCoinToUiCoin, Qd as denomAmountToGrpcChainDenomAmount, Qf as hashToHex, Rd as paginationRequestFromPagination, Rf as isNode, SS as GrpcWebFetchTransport, Sf as spotPriceFromChainPrice, Tf as spotPriceToChainPriceToFixed, Ud as getSpotMarketDecimals, Uf as safeBigIntStringify, Vd as getDerivativeMarketDecimals, Vf as objectToJson, Wd as getSpotMarketTensMultiplier, Wf as sortObjectByKeys, Xd as denomAmountToChainDenomAmount, Xf as decompressPubKey, Yd as denomAmountFromGrpcChainDenomAmount, Yf as TypedMessageV4, Zd as denomAmountToChainDenomAmountToFixed, Zf as domainHash, _f as getExactDecimalsFromNumber, _p as protobufTimestampToUnixSeconds, af as derivativePriceToChainPrice, ap as ripemd160, bf as isNumber, cf as derivativeQuantityFromChainQuantityToFixed, cp as ofacList, df as formatAmountToAllowableAmount, dp as getGasOptionsBasedOnMessage, ef as derivativeMarginFromChainMarginToFixed, ep as privateKeyHashToPublicKey, ff as formatAmountToAllowableDecimals, fp as getGasPriceBasedOnMessage, gf as formatPriceToAllowablePrice, gp as protobufTimestampToUnixMs, hf as formatPriceToAllowableDecimals, hp as protobufTimestampToDate, if as derivativePriceFromChainPriceToFixed, ip as publicKeyToAddress, jd as recoverTypedSignaturePubKey, jf as bigIntToNumber, kf as spotQuantityToChainQuantityToFixed, lf as derivativeQuantityToChainQuantity, lp as getGrpcWebTransport, mf as formatNumberToAllowableTensMultiplier, mp as makeTimeoutTimestampInNs, nf as derivativeMarginToChainMarginToFixed, np as privateKeyToPublicKey, of as derivativePriceToChainPriceToFixed, op as sanitizeTypedData, pf as formatNumberToAllowableDecimals, pp as makeTimeoutTimestamp, qd as denomAmountFromChainDenomAmount, qf as TypedDataUtilsHashStruct, rf as derivativePriceFromChainPrice, rp as privateKeyToPublicKeyBase64, sf as derivativeQuantityFromChainQuantity, sp as sha256, tf as derivativeMarginToChainMargin, tp as privateKeyHashToPublicKeyBase64, uf as derivativeQuantityToChainQuantityToFixed, up as getFixedGasLimitBasedOnMessage, vf as getSignificantDecimalsFromNumber, wf as spotPriceToChainPrice, xf as numberToCosmosSdkDecString, yf as getTensMultiplier, zd as paginationUint8ArrayToString, zf as isReactNative } from "./index-Bq0LFse7.js";
|
|
5
5
|
import "./BaseGrpcConsumer-C4GGGY9p.js";
|
|
6
6
|
import "./index-D0Mc-LvV.js";
|
|
7
7
|
import "./index-C-3GUOfC.js";
|
|
@@ -10,7 +10,7 @@ import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i
|
|
|
10
10
|
import { a as fromBase64, c as hexToBuff, d as toBase64, f as toUtf8, h as uint8ArrayToString, i as concatUint8Arrays, l as hexToUint8Array, m as uint8ArrayToHex, n as base64ToUtf8, o as fromUtf8, p as uint8ArrayToBase64, r as binaryToBase64, s as hexToBase64, t as base64ToUint8Array, u as stringToUint8Array } from "./encoding-light--y1VYXkX.js";
|
|
11
11
|
import { a as BECH32_PUBKEY_CONS_PREFIX, i as BECH32_PUBKEY_ACC_PREFIX, n as BECH32_ADDR_CONS_PREFIX, o as BECH32_PUBKEY_VAL_PREFIX, r as BECH32_ADDR_VAL_PREFIX, s as DEFAULT_DERIVATION_PATH, t as BECH32_ADDR_ACC_PREFIX } from "./constants-Cde3Np7d.js";
|
|
12
12
|
import "./index-CTye-EZi.js";
|
|
13
|
-
import "./index-
|
|
14
|
-
import "./index-
|
|
13
|
+
import "./index-D6Zm6NwF.js";
|
|
14
|
+
import "./index-DMei-AO6.js";
|
|
15
15
|
import "./index-CHeJRhFg.js";
|
|
16
|
-
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, TypedMessageV4, addHexPrefix, amountToCosmosSdkDecAmount, base64ToUint8Array, base64ToUtf8, bigIntReplacer, bigIntToNumber, bigIntToString, binaryToBase64, bytesToHex, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, fetchAllWithTokenPagination, 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, hexToBytes, 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 };
|
|
16
|
+
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, TypedMessageV4, addHexPrefix, amountToCosmosSdkDecAmount, base64ToUint8Array, base64ToUtf8, bigIntReplacer, bigIntToNumber, bigIntToString, binaryToBase64, bytesToHex, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, fetchAllWithTokenPagination, formatAmountToAllowableAmount, formatAmountToAllowableDecimals, formatNumberToAllowableDecimals, formatNumberToAllowableTensMultiplier, formatPriceToAllowableDecimals, formatPriceToAllowablePrice, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getChecksumAddress, getDefaultSubaccountId, getDerivativeMarketDecimals, getDerivativeMarketTensMultiplier, getErrorMessage, getEthereumAddress, getExactDecimalsFromNumber, getFixedGasLimitBasedOnMessage, getGasOptionsBasedOnMessage, getGasPriceBasedOnMessage, getGrpcWebTransport, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSignificantDecimalsFromNumber, getSpotMarketDecimals, getSpotMarketTensMultiplier, getSubaccountId, getTensMultiplier, grpcCoinToUiCoin, grpcPaginationToPagination, grpcPagingToPaging, grpcPagingToPagingV2, hashToHex, hexToBase64, hexToBuff, hexToBytes, 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/dist/esm/utils.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { a as fromBase64, c as hexToBuff, d as toBase64, f as toUtf8, h as uint8ArrayToString, i as concatUint8Arrays, l as hexToUint8Array, m as uint8ArrayToHex, n as base64ToUtf8, o as fromUtf8, p as uint8ArrayToBase64, r as binaryToBase64, s as hexToBase64, t as base64ToUint8Array, u as stringToUint8Array } from "./encoding-light-BpntDob-.js";
|
|
2
2
|
import { a as BECH32_PUBKEY_CONS_PREFIX, i as BECH32_PUBKEY_ACC_PREFIX, n as BECH32_ADDR_CONS_PREFIX, o as BECH32_PUBKEY_VAL_PREFIX, r as BECH32_ADDR_VAL_PREFIX, s as DEFAULT_DERIVATION_PATH, t as BECH32_ADDR_ACC_PREFIX } from "./constants-J9ftgKqC.js";
|
|
3
|
-
import { $ as spotQuantityToChainQuantity, A as derivativePriceToChainPrice, At as sortObjectByKeys, B as formatPriceToAllowableDecimals, C as denomAmountToGrpcChainDenomAmount, Ct as isJsonString, D as derivativeMarginToChainMarginToFixed, Dt as objectToJson, E as derivativeMarginToChainMargin, Et as isServerSide, F as derivativeQuantityToChainQuantityToFixed, Ft as
|
|
4
|
-
import
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
3
|
+
import { $ as spotQuantityToChainQuantity, A as derivativePriceToChainPrice, At as sortObjectByKeys, B as formatPriceToAllowableDecimals, Bt as protobufTimestampToUnixSeconds, C as denomAmountToGrpcChainDenomAmount, Ct as isJsonString, D as derivativeMarginToChainMarginToFixed, Dt as objectToJson, E as derivativeMarginToChainMargin, Et as isServerSide, F as derivativeQuantityToChainQuantityToFixed, Ft as getGasPriceBasedOnMessage, G as isNumber, H as getExactDecimalsFromNumber, I as formatAmountToAllowableAmount, It as makeTimeoutTimestamp, J as spotPriceFromChainPriceToFixed, K as numberToCosmosSdkDecString, L as formatAmountToAllowableDecimals, Lt as makeTimeoutTimestampInNs, M as derivativeQuantityFromChainQuantity, Mt as ofacList, N as derivativeQuantityFromChainQuantityToFixed, Nt as getFixedGasLimitBasedOnMessage, O as derivativePriceFromChainPrice, Ot as protoObjectToJson, P as derivativeQuantityToChainQuantity, Pt as getGasOptionsBasedOnMessage, Q as spotQuantityFromChainQuantityToFixed, R as formatNumberToAllowableDecimals, Rt as protobufTimestampToDate, S as denomAmountToChainDenomAmountToFixed, St as isBrowser, T as derivativeMarginFromChainMarginToFixed, Tt as isReactNative, U as getSignificantDecimalsFromNumber, V as formatPriceToAllowablePrice, W as getTensMultiplier, X as spotPriceToChainPriceToFixed, Y as spotPriceToChainPrice, Z as spotQuantityFromChainQuantity, _ as cosmosSdkDecToBigNumber, _t as bigIntToNumber, a as grpcPagingToPaging, at as domainHash, b as denomAmountFromGrpcChainDenomAmount, bt as grpcCoinToUiCoin, c as paginationRequestFromPagination, ct as privateKeyHashToPublicKey, d as getChecksumAddress, dt as privateKeyToPublicKeyBase64, et as spotQuantityToChainQuantityToFixed, f as getDerivativeMarketDecimals, ft as publicKeyToAddress, g as amountToCosmosSdkDecAmount, gt as bigIntReplacer, h as getSpotMarketTensMultiplier, ht as sha256, i as grpcPaginationToPagination, it as decompressPubKey, j as derivativePriceToChainPriceToFixed, jt as sortObjectByKeysWithReduce, k as derivativePriceFromChainPriceToFixed, kt as safeBigIntStringify, l as paginationUint8ArrayToString, lt as privateKeyHashToPublicKeyBase64, m as getSpotMarketDecimals, mt as sanitizeTypedData, n as fetchAllWithPagination, nt as TypedDataUtilsHashStruct, o as grpcPagingToPagingV2, ot as hashToHex, p as getDerivativeMarketTensMultiplier, pt as ripemd160, q as spotPriceFromChainPrice, r as fetchAllWithTokenPagination, rt as TypedDataUtilsSanitizeData, s as pageRequestToGrpcPageRequestV2, st as messageHash, t as recoverTypedSignaturePubKey, tt as SignTypedDataVersionV4, ut as privateKeyToPublicKey, v as denomAmountFromChainDenomAmount, vt as bigIntToString, w as derivativeMarginFromChainMargin, wt as isNode, x as denomAmountToChainDenomAmount, xt as hexToNumber, y as denomAmountFromChainDenomAmountToFixed, yt as getErrorMessage, z as formatNumberToAllowableTensMultiplier, zt as protobufTimestampToUnixMs } from "./utils-gwPCLHN6.js";
|
|
4
|
+
import "./light-BUFhVek8.js";
|
|
5
|
+
import { n as getGrpcWebTransport, t as GrpcWebFetchTransport } from "./grpc-CSo1TcHx.js";
|
|
6
|
+
import { t as parseCoins } from "./coins-DTdsvmX2.js";
|
|
7
|
+
import { a as getEthereumAddress, c as getSubaccountId, d as removeHexPrefix, i as getDefaultSubaccountId, l as hexToBytes, n as bytesToHex, o as getInjectiveAddress, r as getAddressFromInjectiveAddress, s as getInjectiveAddressFromSubaccountId, t as addHexPrefix, u as isCw20ContractAddress } from "./address-light-CwLNB73Y.js";
|
|
7
8
|
|
|
8
|
-
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, bytesToHex, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, fetchAllWithTokenPagination, 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, hexToBytes, 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 };
|
|
9
|
+
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, bytesToHex, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, fetchAllWithTokenPagination, formatAmountToAllowableAmount, formatAmountToAllowableDecimals, formatNumberToAllowableDecimals, formatNumberToAllowableTensMultiplier, formatPriceToAllowableDecimals, formatPriceToAllowablePrice, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getChecksumAddress, getDefaultSubaccountId, getDerivativeMarketDecimals, getDerivativeMarketTensMultiplier, getErrorMessage, getEthereumAddress, getExactDecimalsFromNumber, getFixedGasLimitBasedOnMessage, getGasOptionsBasedOnMessage, getGasPriceBasedOnMessage, getGrpcWebTransport, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSignificantDecimalsFromNumber, getSpotMarketDecimals, getSpotMarketTensMultiplier, getSubaccountId, getTensMultiplier, grpcCoinToUiCoin, grpcPaginationToPagination, grpcPagingToPaging, grpcPagingToPagingV2, hashToHex, hexToBase64, hexToBuff, hexToBytes, 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.20.
|
|
3
|
+
"version": "1.20.53",
|
|
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": {
|
|
@@ -474,8 +474,8 @@
|
|
|
474
474
|
"@injectivelabs/indexer-proto-ts-v2": "1.20.5",
|
|
475
475
|
"@injectivelabs/mito-proto-ts-v2": "1.17.3",
|
|
476
476
|
"@injectivelabs/olp-proto-ts-v2": "1.17.6",
|
|
477
|
-
"@injectivelabs/platform-services-proto-ts-v2": "1.0.
|
|
478
|
-
"@injectivelabs/tc-abacus-proto-ts-v2": "1.18.
|
|
477
|
+
"@injectivelabs/platform-services-proto-ts-v2": "1.0.8",
|
|
478
|
+
"@injectivelabs/tc-abacus-proto-ts-v2": "1.18.8",
|
|
479
479
|
"@injectivelabs/ws-price-oracle-proto-ts-v2": "1.0.5",
|
|
480
480
|
"@noble/curves": "^1.9.0",
|
|
481
481
|
"@noble/hashes": "^1.8.0",
|
|
@@ -492,10 +492,10 @@
|
|
|
492
492
|
"rxjs": "7.8.2",
|
|
493
493
|
"snakecase-keys": "^5.4.1",
|
|
494
494
|
"viem": "^2.54.6",
|
|
495
|
-
"@injectivelabs/exceptions": "1.20.
|
|
496
|
-
"@injectivelabs/
|
|
497
|
-
"@injectivelabs/
|
|
498
|
-
"@injectivelabs/utils": "1.20.
|
|
495
|
+
"@injectivelabs/exceptions": "1.20.53",
|
|
496
|
+
"@injectivelabs/networks": "1.20.53",
|
|
497
|
+
"@injectivelabs/ts-types": "1.20.53",
|
|
498
|
+
"@injectivelabs/utils": "1.20.53"
|
|
499
499
|
},
|
|
500
500
|
"publishConfig": {
|
|
501
501
|
"access": "public"
|
|
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
|