@injectivelabs/wallet-core 1.20.14 → 1.20.15
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/{broadcaster-CuStNJ2g.cjs → broadcaster-DTwN2Hve.cjs} +129 -32
- package/dist/cjs/broadcaster.cjs +1 -1
- package/dist/cjs/broadcaster.d.cts +1 -1
- package/dist/cjs/{index-aQCoSOFW.d.cts → index-BahXM0mK.d.cts} +10 -4
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/{broadcaster-ZH8xuuQH.js → broadcaster-DzLAEG3E.js} +129 -32
- package/dist/esm/broadcaster.d.ts +1 -1
- package/dist/esm/broadcaster.js +1 -1
- package/dist/esm/{index-D2pR5txS.d.ts → index-D1ZQcpAC.d.ts} +10 -4
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +7 -7
|
@@ -41,6 +41,7 @@ var MsgBroadcaster = class {
|
|
|
41
41
|
require_defineProperty._defineProperty(this, "chainId", void 0);
|
|
42
42
|
require_defineProperty._defineProperty(this, "txTimeout", __injectivelabs_utils.DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
43
43
|
require_defineProperty._defineProperty(this, "simulateTx", true);
|
|
44
|
+
require_defineProperty._defineProperty(this, "useDynamicBaseFee", false);
|
|
44
45
|
require_defineProperty._defineProperty(this, "txTimeoutOnFeeDelegation", false);
|
|
45
46
|
require_defineProperty._defineProperty(this, "evmChainId", void 0);
|
|
46
47
|
require_defineProperty._defineProperty(this, "gasBufferCoefficient", 1.2);
|
|
@@ -50,6 +51,7 @@ var MsgBroadcaster = class {
|
|
|
50
51
|
const networkInfo = (0, __injectivelabs_networks.getNetworkInfo)(options.network);
|
|
51
52
|
this.options = options;
|
|
52
53
|
this.simulateTx = options.simulateTx !== void 0 ? options.simulateTx : true;
|
|
54
|
+
this.useDynamicBaseFee = options.useDynamicBaseFee !== void 0 ? options.useDynamicBaseFee : false;
|
|
53
55
|
this.txTimeout = options.txTimeout || __injectivelabs_utils.DEFAULT_BLOCK_TIMEOUT_HEIGHT;
|
|
54
56
|
this.txTimeoutOnFeeDelegation = options.txTimeoutOnFeeDelegation !== void 0 ? options.txTimeoutOnFeeDelegation : true;
|
|
55
57
|
this.gasBufferCoefficient = options.gasBufferCoefficient || 1.2;
|
|
@@ -61,10 +63,11 @@ var MsgBroadcaster = class {
|
|
|
61
63
|
this.txInclusion = options.txInclusion;
|
|
62
64
|
}
|
|
63
65
|
setOptions(options) {
|
|
64
|
-
this.simulateTx = options.simulateTx
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
66
|
+
this.simulateTx = options.simulateTx !== void 0 ? options.simulateTx : this.simulateTx;
|
|
67
|
+
this.useDynamicBaseFee = options.useDynamicBaseFee !== void 0 ? options.useDynamicBaseFee : this.useDynamicBaseFee;
|
|
68
|
+
this.txTimeout = options.txTimeout !== void 0 ? options.txTimeout : this.txTimeout;
|
|
69
|
+
this.txTimeoutOnFeeDelegation = options.txTimeoutOnFeeDelegation !== void 0 ? options.txTimeoutOnFeeDelegation : this.txTimeoutOnFeeDelegation;
|
|
70
|
+
this.txInclusion = options.txInclusion !== void 0 ? options.txInclusion : this.txInclusion;
|
|
68
71
|
}
|
|
69
72
|
async getEvmChainId() {
|
|
70
73
|
const { walletStrategy } = this;
|
|
@@ -234,9 +237,18 @@ var MsgBroadcaster = class {
|
|
|
234
237
|
const { chainId, endpoints, walletStrategy } = this;
|
|
235
238
|
const txTimeoutInBlocks = this.resolveTimeoutInBlocks(tx.txTimeoutInBlocks);
|
|
236
239
|
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs];
|
|
237
|
-
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails(
|
|
240
|
+
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails({
|
|
241
|
+
latestHeight: tx.latestHeight,
|
|
242
|
+
timeoutHeight: tx.timeoutHeight,
|
|
243
|
+
address: tx.injectiveAddress,
|
|
244
|
+
existingAccountDetails: tx.accountDetails
|
|
245
|
+
})]);
|
|
238
246
|
if (!evmChainId) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
239
|
-
const timeoutHeight =
|
|
247
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
248
|
+
tx,
|
|
249
|
+
latestHeight,
|
|
250
|
+
txTimeoutInBlocks
|
|
251
|
+
});
|
|
240
252
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
241
253
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
242
254
|
const gas = (((_tx$gas = tx.gas) === null || _tx$gas === void 0 ? void 0 : _tx$gas.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
@@ -345,9 +357,18 @@ var MsgBroadcaster = class {
|
|
|
345
357
|
const { chainId, endpoints, walletStrategy } = this;
|
|
346
358
|
const txTimeoutInBlocks = this.resolveTimeoutInBlocks(tx.txTimeoutInBlocks);
|
|
347
359
|
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs];
|
|
348
|
-
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails(
|
|
360
|
+
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails({
|
|
361
|
+
latestHeight: tx.latestHeight,
|
|
362
|
+
timeoutHeight: tx.timeoutHeight,
|
|
363
|
+
address: tx.injectiveAddress,
|
|
364
|
+
existingAccountDetails: tx.accountDetails
|
|
365
|
+
})]);
|
|
349
366
|
if (!evmChainId) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
350
|
-
const timeoutHeight =
|
|
367
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
368
|
+
tx,
|
|
369
|
+
latestHeight,
|
|
370
|
+
txTimeoutInBlocks
|
|
371
|
+
});
|
|
351
372
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
352
373
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
353
374
|
const gas = (((_tx$gas2 = tx.gas) === null || _tx$gas2 === void 0 ? void 0 : _tx$gas2.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
@@ -462,11 +483,22 @@ var MsgBroadcaster = class {
|
|
|
462
483
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
463
484
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
464
485
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
465
|
-
let timeoutHeight =
|
|
466
|
-
|
|
486
|
+
let timeoutHeight = this.resolveOptionalTimeoutHeight({
|
|
487
|
+
tx,
|
|
488
|
+
latestHeight: tx.latestHeight,
|
|
489
|
+
txTimeoutInBlocks
|
|
490
|
+
});
|
|
491
|
+
if (timeoutHeight === void 0 && txTimeoutOnFeeDelegation) {
|
|
492
|
+
const latestHeight = (await new __injectivelabs_sdk_ts_client_chain.ChainGrpcTendermintApi(endpoints.grpc).fetchLatestBlock()).header.height.toString();
|
|
493
|
+
timeoutHeight = this.resolveTimeoutHeight({
|
|
494
|
+
tx,
|
|
495
|
+
latestHeight,
|
|
496
|
+
txTimeoutInBlocks
|
|
497
|
+
});
|
|
498
|
+
}
|
|
467
499
|
walletStrategy.emit(__injectivelabs_wallet_base.WalletStrategyEmitterEventType.TransactionPreparationStart);
|
|
468
500
|
const prepareTxResponse = await transactionApi.prepareTxRequest({
|
|
469
|
-
timeoutHeight,
|
|
501
|
+
timeoutHeight: timeoutHeight === null || timeoutHeight === void 0 ? void 0 : timeoutHeight.toNumber(),
|
|
470
502
|
memo: tx.memo,
|
|
471
503
|
message: web3Msgs,
|
|
472
504
|
address: tx.ethereumAddress,
|
|
@@ -532,8 +564,17 @@ var MsgBroadcaster = class {
|
|
|
532
564
|
if ([__injectivelabs_wallet_base.Wallet.Keplr, __injectivelabs_wallet_base.Wallet.Leap].includes(walletStrategy.getWallet())) {
|
|
533
565
|
if (await walletStrategy.getWalletDeviceType() === __injectivelabs_wallet_base.WalletDeviceType.Hardware) return this.experimentalBroadcastWalletThroughLedger(tx);
|
|
534
566
|
}
|
|
535
|
-
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails(
|
|
536
|
-
|
|
567
|
+
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails({
|
|
568
|
+
latestHeight: tx.latestHeight,
|
|
569
|
+
timeoutHeight: tx.timeoutHeight,
|
|
570
|
+
address: tx.injectiveAddress,
|
|
571
|
+
existingAccountDetails: tx.accountDetails
|
|
572
|
+
}), walletStrategy.getPubKey(tx.injectiveAddress)]);
|
|
573
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
574
|
+
tx,
|
|
575
|
+
latestHeight,
|
|
576
|
+
txTimeoutInBlocks
|
|
577
|
+
});
|
|
537
578
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
538
579
|
const signMode = (0, __injectivelabs_wallet_base.isCosmosAminoOnlyWallet)(walletStrategy.wallet) ? __injectivelabs_sdk_ts_core_tx.SIGN_EIP712 : __injectivelabs_sdk_ts_core_tx.SIGN_DIRECT;
|
|
539
580
|
const gas = (((_tx$gas3 = tx.gas) === null || _tx$gas3 === void 0 ? void 0 : _tx$gas3.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
@@ -659,8 +700,17 @@ var MsgBroadcaster = class {
|
|
|
659
700
|
}
|
|
660
701
|
if (!evmChainId) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
661
702
|
const cosmosWallet = walletStrategy.getCosmosWallet(chainId);
|
|
662
|
-
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails(
|
|
663
|
-
|
|
703
|
+
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails({
|
|
704
|
+
latestHeight: tx.latestHeight,
|
|
705
|
+
timeoutHeight: tx.timeoutHeight,
|
|
706
|
+
address: tx.injectiveAddress,
|
|
707
|
+
existingAccountDetails: tx.accountDetails
|
|
708
|
+
}), walletStrategy.getPubKey()]);
|
|
709
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
710
|
+
tx,
|
|
711
|
+
latestHeight,
|
|
712
|
+
txTimeoutInBlocks
|
|
713
|
+
});
|
|
664
714
|
const gas = (((_tx$gas5 = tx.gas) === null || _tx$gas5 === void 0 ? void 0 : _tx$gas5.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
665
715
|
/** EIP712 for signing on Ethereum wallets */
|
|
666
716
|
const eip712TypedData = (0, __injectivelabs_sdk_ts_core_tx.getEip712TypedData)({
|
|
@@ -751,7 +801,12 @@ var MsgBroadcaster = class {
|
|
|
751
801
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
752
802
|
const fetchAccountBlockDetails = async () => {
|
|
753
803
|
try {
|
|
754
|
-
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails(
|
|
804
|
+
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails({
|
|
805
|
+
latestHeight: tx.latestHeight,
|
|
806
|
+
timeoutHeight: tx.timeoutHeight,
|
|
807
|
+
address: tx.injectiveAddress,
|
|
808
|
+
existingAccountDetails: tx.accountDetails
|
|
809
|
+
});
|
|
755
810
|
return {
|
|
756
811
|
baseAccount: baseAccount$1,
|
|
757
812
|
latestHeight: latestHeight$1
|
|
@@ -765,7 +820,11 @@ var MsgBroadcaster = class {
|
|
|
765
820
|
memo: tx.memo,
|
|
766
821
|
estimateGas: simulateTx
|
|
767
822
|
});
|
|
768
|
-
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails(
|
|
823
|
+
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails({
|
|
824
|
+
latestHeight: tx.latestHeight,
|
|
825
|
+
timeoutHeight: tx.timeoutHeight,
|
|
826
|
+
address: tx.injectiveAddress
|
|
827
|
+
});
|
|
769
828
|
return {
|
|
770
829
|
baseAccount: baseAccount$1,
|
|
771
830
|
latestHeight: latestHeight$1
|
|
@@ -774,14 +833,21 @@ var MsgBroadcaster = class {
|
|
|
774
833
|
throw e;
|
|
775
834
|
}
|
|
776
835
|
};
|
|
777
|
-
/** Account Details * */
|
|
778
|
-
const { baseAccount, latestHeight } = await fetchAccountBlockDetails();
|
|
779
836
|
const chainGrpcAuthApi = new __injectivelabs_sdk_ts_client_chain.ChainGrpcAuthApi(endpoints.grpc);
|
|
780
837
|
if (httpHeaders) chainGrpcAuthApi.setMetadata(httpHeaders);
|
|
781
|
-
const
|
|
782
|
-
|
|
838
|
+
const [accountBlockDetails, feePayerAccountDetails, pubKey] = await Promise.all([
|
|
839
|
+
fetchAccountBlockDetails(),
|
|
840
|
+
chainGrpcAuthApi.fetchAccount(feePayer),
|
|
841
|
+
walletStrategy.getPubKey()
|
|
842
|
+
]);
|
|
843
|
+
const { baseAccount, latestHeight } = accountBlockDetails;
|
|
844
|
+
const { baseAccount: feePayerBaseAccount } = feePayerAccountDetails;
|
|
845
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
846
|
+
tx,
|
|
847
|
+
latestHeight,
|
|
848
|
+
txTimeoutInBlocks: txTimeoutOnFeeDelegation ? txTimeoutInBlocks : __injectivelabs_utils.DEFAULT_BLOCK_TIMEOUT_HEIGHT
|
|
849
|
+
});
|
|
783
850
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * __injectivelabs_utils.DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
784
|
-
const pubKey = await walletStrategy.getPubKey();
|
|
785
851
|
const gas = (((_tx$gas7 = tx.gas) === null || _tx$gas7 === void 0 ? void 0 : _tx$gas7.gas) || (0, __injectivelabs_sdk_ts_utils.getGasPriceBasedOnMessage)(msgs)).toString();
|
|
786
852
|
/** Prepare the Transaction * */
|
|
787
853
|
const { txRaw } = await this.getTxWithSignersAndStdFee({
|
|
@@ -872,7 +938,9 @@ var MsgBroadcaster = class {
|
|
|
872
938
|
return response.feePayerPubKey.key;
|
|
873
939
|
}
|
|
874
940
|
async getStdFeeWithDynamicBaseFee(args) {
|
|
875
|
-
const
|
|
941
|
+
const { endpoints, useDynamicBaseFee } = this;
|
|
942
|
+
if (!useDynamicBaseFee) return (0, __injectivelabs_utils.getStdFee)(args);
|
|
943
|
+
const client = new __injectivelabs_sdk_ts_client_chain.ChainGrpcTxFeesApi(endpoints.grpc);
|
|
876
944
|
let baseFee = __injectivelabs_utils.DEFAULT_GAS_PRICE;
|
|
877
945
|
try {
|
|
878
946
|
const response = await client.fetchEipBaseFee();
|
|
@@ -960,23 +1028,52 @@ var MsgBroadcaster = class {
|
|
|
960
1028
|
throw e;
|
|
961
1029
|
}
|
|
962
1030
|
}
|
|
963
|
-
async fetchAccountAndBlockDetails(address, existingAccountDetails) {
|
|
1031
|
+
async fetchAccountAndBlockDetails({ address, latestHeight, timeoutHeight, existingAccountDetails }) {
|
|
964
1032
|
const { endpoints, httpHeaders } = this;
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1033
|
+
const shouldFetchLatestHeight = latestHeight === void 0 && timeoutHeight === void 0;
|
|
1034
|
+
if (existingAccountDetails) {
|
|
1035
|
+
if (!shouldFetchLatestHeight) return {
|
|
1036
|
+
latestHeight: latestHeight === null || latestHeight === void 0 ? void 0 : latestHeight.toString(),
|
|
1037
|
+
baseAccount: existingAccountDetails
|
|
1038
|
+
};
|
|
1039
|
+
const tendermintClient$1 = new __injectivelabs_sdk_ts_client_chain.ChainGrpcTendermintApi(endpoints.grpc);
|
|
1040
|
+
if (httpHeaders) tendermintClient$1.setMetadata(httpHeaders);
|
|
1041
|
+
return {
|
|
1042
|
+
baseAccount: existingAccountDetails,
|
|
1043
|
+
latestHeight: (await tendermintClient$1.fetchLatestBlock()).header.height.toString()
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
971
1046
|
const chainClient = new __injectivelabs_sdk_ts_client_chain.ChainGrpcAuthApi(endpoints.grpc);
|
|
972
1047
|
if (httpHeaders) chainClient.setMetadata(httpHeaders);
|
|
1048
|
+
if (!shouldFetchLatestHeight) {
|
|
1049
|
+
const accountDetails$1 = await chainClient.fetchAccount(address);
|
|
1050
|
+
return {
|
|
1051
|
+
latestHeight: latestHeight === null || latestHeight === void 0 ? void 0 : latestHeight.toString(),
|
|
1052
|
+
baseAccount: accountDetails$1.baseAccount
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
const tendermintClient = new __injectivelabs_sdk_ts_client_chain.ChainGrpcTendermintApi(endpoints.grpc);
|
|
1056
|
+
if (httpHeaders) tendermintClient.setMetadata(httpHeaders);
|
|
973
1057
|
const [accountDetails, latestBlock] = await Promise.all([chainClient.fetchAccount(address), tendermintClient.fetchLatestBlock()]);
|
|
974
|
-
const { baseAccount } = accountDetails;
|
|
975
1058
|
return {
|
|
976
|
-
baseAccount,
|
|
1059
|
+
baseAccount: accountDetails.baseAccount,
|
|
977
1060
|
latestHeight: latestBlock.header.height.toString()
|
|
978
1061
|
};
|
|
979
1062
|
}
|
|
1063
|
+
resolveOptionalTimeoutHeight({ tx, latestHeight, txTimeoutInBlocks }) {
|
|
1064
|
+
if (tx.timeoutHeight !== void 0) return (0, __injectivelabs_utils.toBigNumber)(tx.timeoutHeight);
|
|
1065
|
+
if (latestHeight === void 0) return;
|
|
1066
|
+
return (0, __injectivelabs_utils.toBigNumber)(latestHeight).plus(txTimeoutInBlocks);
|
|
1067
|
+
}
|
|
1068
|
+
resolveTimeoutHeight({ tx, latestHeight, txTimeoutInBlocks }) {
|
|
1069
|
+
const timeoutHeight = this.resolveOptionalTimeoutHeight({
|
|
1070
|
+
tx,
|
|
1071
|
+
latestHeight,
|
|
1072
|
+
txTimeoutInBlocks
|
|
1073
|
+
});
|
|
1074
|
+
if (!timeoutHeight) throw new __injectivelabs_exceptions.GeneralException(/* @__PURE__ */ new Error("Please provide latestHeight or timeoutHeight"));
|
|
1075
|
+
return timeoutHeight;
|
|
1076
|
+
}
|
|
980
1077
|
resolveTimeoutInBlocks(override) {
|
|
981
1078
|
return typeof override === "number" && Number.isInteger(override) && override > 0 ? override : this.txTimeout;
|
|
982
1079
|
}
|
package/dist/cjs/broadcaster.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./BaseWalletStrategy-Bvs5nQRI.cjs";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-BahXM0mK.cjs";
|
|
3
3
|
export { MsgBroadcaster, MsgBroadcasterOptions, MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, Web3Broadcaster };
|
|
@@ -12,6 +12,8 @@ interface MsgBroadcasterTxOptions {
|
|
|
12
12
|
ethereumAddress?: string;
|
|
13
13
|
injectiveAddress?: string;
|
|
14
14
|
accountDetails?: AuthBaseAccount;
|
|
15
|
+
latestHeight?: number | string;
|
|
16
|
+
timeoutHeight?: number | string;
|
|
15
17
|
txTimeoutInBlocks?: number;
|
|
16
18
|
txInclusion?: TxClientInclusionOptions;
|
|
17
19
|
gas?: {
|
|
@@ -27,15 +29,16 @@ interface MsgBroadcasterTxOptionsWithAddresses extends MsgBroadcasterTxOptions {
|
|
|
27
29
|
}
|
|
28
30
|
interface MsgBroadcasterOptions {
|
|
29
31
|
network: Network;
|
|
30
|
-
endpoints?: NetworkEndpoints;
|
|
31
32
|
chainId?: ChainId;
|
|
33
|
+
txTimeout?: number;
|
|
34
|
+
simulateTx?: boolean;
|
|
32
35
|
evmChainId?: EvmChainId;
|
|
33
36
|
feePayerPubKey?: string;
|
|
34
|
-
|
|
35
|
-
txTimeoutOnFeeDelegation?: boolean;
|
|
36
|
-
txTimeout?: number;
|
|
37
|
+
endpoints?: NetworkEndpoints;
|
|
37
38
|
txInclusion?: TxClientInclusionOptions;
|
|
38
39
|
walletStrategy: BaseWalletStrategy;
|
|
40
|
+
useDynamicBaseFee?: boolean;
|
|
41
|
+
txTimeoutOnFeeDelegation?: boolean;
|
|
39
42
|
gasBufferCoefficient?: number;
|
|
40
43
|
httpHeaders?: Record<string, string>;
|
|
41
44
|
}
|
|
@@ -55,6 +58,7 @@ declare class MsgBroadcaster {
|
|
|
55
58
|
chainId: ChainId;
|
|
56
59
|
txTimeout: number;
|
|
57
60
|
simulateTx: boolean;
|
|
61
|
+
useDynamicBaseFee: boolean;
|
|
58
62
|
txTimeoutOnFeeDelegation: boolean;
|
|
59
63
|
evmChainId?: EvmChainId;
|
|
60
64
|
gasBufferCoefficient: number;
|
|
@@ -204,6 +208,8 @@ declare class MsgBroadcaster {
|
|
|
204
208
|
private simulateTxWithSigners;
|
|
205
209
|
private retryOnException;
|
|
206
210
|
private fetchAccountAndBlockDetails;
|
|
211
|
+
private resolveOptionalTimeoutHeight;
|
|
212
|
+
private resolveTimeoutHeight;
|
|
207
213
|
private resolveTimeoutInBlocks;
|
|
208
214
|
private resolveTxInclusionOptions;
|
|
209
215
|
private createTxGrpcApi;
|
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseWalletStrategy } from "./BaseWalletStrategy-Bvs5nQRI.cjs";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-BahXM0mK.cjs";
|
|
3
3
|
import "./index-DLoAMD9J.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/tx.d.ts
|
|
@@ -41,6 +41,7 @@ var MsgBroadcaster = class {
|
|
|
41
41
|
_defineProperty(this, "chainId", void 0);
|
|
42
42
|
_defineProperty(this, "txTimeout", DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
43
43
|
_defineProperty(this, "simulateTx", true);
|
|
44
|
+
_defineProperty(this, "useDynamicBaseFee", false);
|
|
44
45
|
_defineProperty(this, "txTimeoutOnFeeDelegation", false);
|
|
45
46
|
_defineProperty(this, "evmChainId", void 0);
|
|
46
47
|
_defineProperty(this, "gasBufferCoefficient", 1.2);
|
|
@@ -50,6 +51,7 @@ var MsgBroadcaster = class {
|
|
|
50
51
|
const networkInfo = getNetworkInfo(options.network);
|
|
51
52
|
this.options = options;
|
|
52
53
|
this.simulateTx = options.simulateTx !== void 0 ? options.simulateTx : true;
|
|
54
|
+
this.useDynamicBaseFee = options.useDynamicBaseFee !== void 0 ? options.useDynamicBaseFee : false;
|
|
53
55
|
this.txTimeout = options.txTimeout || DEFAULT_BLOCK_TIMEOUT_HEIGHT;
|
|
54
56
|
this.txTimeoutOnFeeDelegation = options.txTimeoutOnFeeDelegation !== void 0 ? options.txTimeoutOnFeeDelegation : true;
|
|
55
57
|
this.gasBufferCoefficient = options.gasBufferCoefficient || 1.2;
|
|
@@ -61,10 +63,11 @@ var MsgBroadcaster = class {
|
|
|
61
63
|
this.txInclusion = options.txInclusion;
|
|
62
64
|
}
|
|
63
65
|
setOptions(options) {
|
|
64
|
-
this.simulateTx = options.simulateTx
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
66
|
+
this.simulateTx = options.simulateTx !== void 0 ? options.simulateTx : this.simulateTx;
|
|
67
|
+
this.useDynamicBaseFee = options.useDynamicBaseFee !== void 0 ? options.useDynamicBaseFee : this.useDynamicBaseFee;
|
|
68
|
+
this.txTimeout = options.txTimeout !== void 0 ? options.txTimeout : this.txTimeout;
|
|
69
|
+
this.txTimeoutOnFeeDelegation = options.txTimeoutOnFeeDelegation !== void 0 ? options.txTimeoutOnFeeDelegation : this.txTimeoutOnFeeDelegation;
|
|
70
|
+
this.txInclusion = options.txInclusion !== void 0 ? options.txInclusion : this.txInclusion;
|
|
68
71
|
}
|
|
69
72
|
async getEvmChainId() {
|
|
70
73
|
const { walletStrategy } = this;
|
|
@@ -234,9 +237,18 @@ var MsgBroadcaster = class {
|
|
|
234
237
|
const { chainId, endpoints, walletStrategy } = this;
|
|
235
238
|
const txTimeoutInBlocks = this.resolveTimeoutInBlocks(tx.txTimeoutInBlocks);
|
|
236
239
|
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs];
|
|
237
|
-
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails(
|
|
240
|
+
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails({
|
|
241
|
+
latestHeight: tx.latestHeight,
|
|
242
|
+
timeoutHeight: tx.timeoutHeight,
|
|
243
|
+
address: tx.injectiveAddress,
|
|
244
|
+
existingAccountDetails: tx.accountDetails
|
|
245
|
+
})]);
|
|
238
246
|
if (!evmChainId) throw new GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
239
|
-
const timeoutHeight =
|
|
247
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
248
|
+
tx,
|
|
249
|
+
latestHeight,
|
|
250
|
+
txTimeoutInBlocks
|
|
251
|
+
});
|
|
240
252
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
241
253
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
242
254
|
const gas = (((_tx$gas = tx.gas) === null || _tx$gas === void 0 ? void 0 : _tx$gas.gas) || getGasPriceBasedOnMessage(msgs)).toString();
|
|
@@ -345,9 +357,18 @@ var MsgBroadcaster = class {
|
|
|
345
357
|
const { chainId, endpoints, walletStrategy } = this;
|
|
346
358
|
const txTimeoutInBlocks = this.resolveTimeoutInBlocks(tx.txTimeoutInBlocks);
|
|
347
359
|
const msgs = Array.isArray(tx.msgs) ? tx.msgs : [tx.msgs];
|
|
348
|
-
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails(
|
|
360
|
+
const [evmChainId, { baseAccount, latestHeight }] = await Promise.all([this.getEvmChainId(), this.fetchAccountAndBlockDetails({
|
|
361
|
+
latestHeight: tx.latestHeight,
|
|
362
|
+
timeoutHeight: tx.timeoutHeight,
|
|
363
|
+
address: tx.injectiveAddress,
|
|
364
|
+
existingAccountDetails: tx.accountDetails
|
|
365
|
+
})]);
|
|
349
366
|
if (!evmChainId) throw new GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
350
|
-
const timeoutHeight =
|
|
367
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
368
|
+
tx,
|
|
369
|
+
latestHeight,
|
|
370
|
+
txTimeoutInBlocks
|
|
371
|
+
});
|
|
351
372
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
352
373
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
353
374
|
const gas = (((_tx$gas2 = tx.gas) === null || _tx$gas2 === void 0 ? void 0 : _tx$gas2.gas) || getGasPriceBasedOnMessage(msgs)).toString();
|
|
@@ -462,11 +483,22 @@ var MsgBroadcaster = class {
|
|
|
462
483
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
463
484
|
const txTimeoutTimeInSeconds = txTimeoutInBlocks * DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
464
485
|
const txTimeoutTimeInMilliSeconds = txTimeoutTimeInSeconds * 1e3;
|
|
465
|
-
let timeoutHeight =
|
|
466
|
-
|
|
486
|
+
let timeoutHeight = this.resolveOptionalTimeoutHeight({
|
|
487
|
+
tx,
|
|
488
|
+
latestHeight: tx.latestHeight,
|
|
489
|
+
txTimeoutInBlocks
|
|
490
|
+
});
|
|
491
|
+
if (timeoutHeight === void 0 && txTimeoutOnFeeDelegation) {
|
|
492
|
+
const latestHeight = (await new ChainGrpcTendermintApi(endpoints.grpc).fetchLatestBlock()).header.height.toString();
|
|
493
|
+
timeoutHeight = this.resolveTimeoutHeight({
|
|
494
|
+
tx,
|
|
495
|
+
latestHeight,
|
|
496
|
+
txTimeoutInBlocks
|
|
497
|
+
});
|
|
498
|
+
}
|
|
467
499
|
walletStrategy.emit(WalletStrategyEmitterEventType.TransactionPreparationStart);
|
|
468
500
|
const prepareTxResponse = await transactionApi.prepareTxRequest({
|
|
469
|
-
timeoutHeight,
|
|
501
|
+
timeoutHeight: timeoutHeight === null || timeoutHeight === void 0 ? void 0 : timeoutHeight.toNumber(),
|
|
470
502
|
memo: tx.memo,
|
|
471
503
|
message: web3Msgs,
|
|
472
504
|
address: tx.ethereumAddress,
|
|
@@ -532,8 +564,17 @@ var MsgBroadcaster = class {
|
|
|
532
564
|
if ([Wallet.Keplr, Wallet.Leap].includes(walletStrategy.getWallet())) {
|
|
533
565
|
if (await walletStrategy.getWalletDeviceType() === WalletDeviceType.Hardware) return this.experimentalBroadcastWalletThroughLedger(tx);
|
|
534
566
|
}
|
|
535
|
-
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails(
|
|
536
|
-
|
|
567
|
+
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails({
|
|
568
|
+
latestHeight: tx.latestHeight,
|
|
569
|
+
timeoutHeight: tx.timeoutHeight,
|
|
570
|
+
address: tx.injectiveAddress,
|
|
571
|
+
existingAccountDetails: tx.accountDetails
|
|
572
|
+
}), walletStrategy.getPubKey(tx.injectiveAddress)]);
|
|
573
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
574
|
+
tx,
|
|
575
|
+
latestHeight,
|
|
576
|
+
txTimeoutInBlocks
|
|
577
|
+
});
|
|
537
578
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
538
579
|
const signMode = isCosmosAminoOnlyWallet(walletStrategy.wallet) ? SIGN_EIP712 : SIGN_DIRECT;
|
|
539
580
|
const gas = (((_tx$gas3 = tx.gas) === null || _tx$gas3 === void 0 ? void 0 : _tx$gas3.gas) || getGasPriceBasedOnMessage(msgs)).toString();
|
|
@@ -659,8 +700,17 @@ var MsgBroadcaster = class {
|
|
|
659
700
|
}
|
|
660
701
|
if (!evmChainId) throw new GeneralException(/* @__PURE__ */ new Error("Please provide evmChainId"));
|
|
661
702
|
const cosmosWallet = walletStrategy.getCosmosWallet(chainId);
|
|
662
|
-
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails(
|
|
663
|
-
|
|
703
|
+
const [{ baseAccount, latestHeight }, pubKey] = await Promise.all([this.fetchAccountAndBlockDetails({
|
|
704
|
+
latestHeight: tx.latestHeight,
|
|
705
|
+
timeoutHeight: tx.timeoutHeight,
|
|
706
|
+
address: tx.injectiveAddress,
|
|
707
|
+
existingAccountDetails: tx.accountDetails
|
|
708
|
+
}), walletStrategy.getPubKey()]);
|
|
709
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
710
|
+
tx,
|
|
711
|
+
latestHeight,
|
|
712
|
+
txTimeoutInBlocks
|
|
713
|
+
});
|
|
664
714
|
const gas = (((_tx$gas5 = tx.gas) === null || _tx$gas5 === void 0 ? void 0 : _tx$gas5.gas) || getGasPriceBasedOnMessage(msgs)).toString();
|
|
665
715
|
/** EIP712 for signing on Ethereum wallets */
|
|
666
716
|
const eip712TypedData = getEip712TypedData({
|
|
@@ -751,7 +801,12 @@ var MsgBroadcaster = class {
|
|
|
751
801
|
if (httpHeaders) transactionApi.setMetadata(httpHeaders);
|
|
752
802
|
const fetchAccountBlockDetails = async () => {
|
|
753
803
|
try {
|
|
754
|
-
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails(
|
|
804
|
+
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails({
|
|
805
|
+
latestHeight: tx.latestHeight,
|
|
806
|
+
timeoutHeight: tx.timeoutHeight,
|
|
807
|
+
address: tx.injectiveAddress,
|
|
808
|
+
existingAccountDetails: tx.accountDetails
|
|
809
|
+
});
|
|
755
810
|
return {
|
|
756
811
|
baseAccount: baseAccount$1,
|
|
757
812
|
latestHeight: latestHeight$1
|
|
@@ -765,7 +820,11 @@ var MsgBroadcaster = class {
|
|
|
765
820
|
memo: tx.memo,
|
|
766
821
|
estimateGas: simulateTx
|
|
767
822
|
});
|
|
768
|
-
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails(
|
|
823
|
+
const { baseAccount: baseAccount$1, latestHeight: latestHeight$1 } = await this.fetchAccountAndBlockDetails({
|
|
824
|
+
latestHeight: tx.latestHeight,
|
|
825
|
+
timeoutHeight: tx.timeoutHeight,
|
|
826
|
+
address: tx.injectiveAddress
|
|
827
|
+
});
|
|
769
828
|
return {
|
|
770
829
|
baseAccount: baseAccount$1,
|
|
771
830
|
latestHeight: latestHeight$1
|
|
@@ -774,14 +833,21 @@ var MsgBroadcaster = class {
|
|
|
774
833
|
throw e;
|
|
775
834
|
}
|
|
776
835
|
};
|
|
777
|
-
/** Account Details * */
|
|
778
|
-
const { baseAccount, latestHeight } = await fetchAccountBlockDetails();
|
|
779
836
|
const chainGrpcAuthApi = new ChainGrpcAuthApi(endpoints.grpc);
|
|
780
837
|
if (httpHeaders) chainGrpcAuthApi.setMetadata(httpHeaders);
|
|
781
|
-
const
|
|
782
|
-
|
|
838
|
+
const [accountBlockDetails, feePayerAccountDetails, pubKey] = await Promise.all([
|
|
839
|
+
fetchAccountBlockDetails(),
|
|
840
|
+
chainGrpcAuthApi.fetchAccount(feePayer),
|
|
841
|
+
walletStrategy.getPubKey()
|
|
842
|
+
]);
|
|
843
|
+
const { baseAccount, latestHeight } = accountBlockDetails;
|
|
844
|
+
const { baseAccount: feePayerBaseAccount } = feePayerAccountDetails;
|
|
845
|
+
const timeoutHeight = this.resolveTimeoutHeight({
|
|
846
|
+
tx,
|
|
847
|
+
latestHeight,
|
|
848
|
+
txTimeoutInBlocks: txTimeoutOnFeeDelegation ? txTimeoutInBlocks : DEFAULT_BLOCK_TIMEOUT_HEIGHT
|
|
849
|
+
});
|
|
783
850
|
const txTimeoutTimeInMilliSeconds = txTimeoutInBlocks * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3;
|
|
784
|
-
const pubKey = await walletStrategy.getPubKey();
|
|
785
851
|
const gas = (((_tx$gas7 = tx.gas) === null || _tx$gas7 === void 0 ? void 0 : _tx$gas7.gas) || getGasPriceBasedOnMessage(msgs)).toString();
|
|
786
852
|
/** Prepare the Transaction * */
|
|
787
853
|
const { txRaw } = await this.getTxWithSignersAndStdFee({
|
|
@@ -872,7 +938,9 @@ var MsgBroadcaster = class {
|
|
|
872
938
|
return response.feePayerPubKey.key;
|
|
873
939
|
}
|
|
874
940
|
async getStdFeeWithDynamicBaseFee(args) {
|
|
875
|
-
const
|
|
941
|
+
const { endpoints, useDynamicBaseFee } = this;
|
|
942
|
+
if (!useDynamicBaseFee) return getStdFee(args);
|
|
943
|
+
const client = new ChainGrpcTxFeesApi(endpoints.grpc);
|
|
876
944
|
let baseFee = DEFAULT_GAS_PRICE;
|
|
877
945
|
try {
|
|
878
946
|
const response = await client.fetchEipBaseFee();
|
|
@@ -960,23 +1028,52 @@ var MsgBroadcaster = class {
|
|
|
960
1028
|
throw e;
|
|
961
1029
|
}
|
|
962
1030
|
}
|
|
963
|
-
async fetchAccountAndBlockDetails(address, existingAccountDetails) {
|
|
1031
|
+
async fetchAccountAndBlockDetails({ address, latestHeight, timeoutHeight, existingAccountDetails }) {
|
|
964
1032
|
const { endpoints, httpHeaders } = this;
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1033
|
+
const shouldFetchLatestHeight = latestHeight === void 0 && timeoutHeight === void 0;
|
|
1034
|
+
if (existingAccountDetails) {
|
|
1035
|
+
if (!shouldFetchLatestHeight) return {
|
|
1036
|
+
latestHeight: latestHeight === null || latestHeight === void 0 ? void 0 : latestHeight.toString(),
|
|
1037
|
+
baseAccount: existingAccountDetails
|
|
1038
|
+
};
|
|
1039
|
+
const tendermintClient$1 = new ChainGrpcTendermintApi(endpoints.grpc);
|
|
1040
|
+
if (httpHeaders) tendermintClient$1.setMetadata(httpHeaders);
|
|
1041
|
+
return {
|
|
1042
|
+
baseAccount: existingAccountDetails,
|
|
1043
|
+
latestHeight: (await tendermintClient$1.fetchLatestBlock()).header.height.toString()
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
971
1046
|
const chainClient = new ChainGrpcAuthApi(endpoints.grpc);
|
|
972
1047
|
if (httpHeaders) chainClient.setMetadata(httpHeaders);
|
|
1048
|
+
if (!shouldFetchLatestHeight) {
|
|
1049
|
+
const accountDetails$1 = await chainClient.fetchAccount(address);
|
|
1050
|
+
return {
|
|
1051
|
+
latestHeight: latestHeight === null || latestHeight === void 0 ? void 0 : latestHeight.toString(),
|
|
1052
|
+
baseAccount: accountDetails$1.baseAccount
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
const tendermintClient = new ChainGrpcTendermintApi(endpoints.grpc);
|
|
1056
|
+
if (httpHeaders) tendermintClient.setMetadata(httpHeaders);
|
|
973
1057
|
const [accountDetails, latestBlock] = await Promise.all([chainClient.fetchAccount(address), tendermintClient.fetchLatestBlock()]);
|
|
974
|
-
const { baseAccount } = accountDetails;
|
|
975
1058
|
return {
|
|
976
|
-
baseAccount,
|
|
1059
|
+
baseAccount: accountDetails.baseAccount,
|
|
977
1060
|
latestHeight: latestBlock.header.height.toString()
|
|
978
1061
|
};
|
|
979
1062
|
}
|
|
1063
|
+
resolveOptionalTimeoutHeight({ tx, latestHeight, txTimeoutInBlocks }) {
|
|
1064
|
+
if (tx.timeoutHeight !== void 0) return toBigNumber(tx.timeoutHeight);
|
|
1065
|
+
if (latestHeight === void 0) return;
|
|
1066
|
+
return toBigNumber(latestHeight).plus(txTimeoutInBlocks);
|
|
1067
|
+
}
|
|
1068
|
+
resolveTimeoutHeight({ tx, latestHeight, txTimeoutInBlocks }) {
|
|
1069
|
+
const timeoutHeight = this.resolveOptionalTimeoutHeight({
|
|
1070
|
+
tx,
|
|
1071
|
+
latestHeight,
|
|
1072
|
+
txTimeoutInBlocks
|
|
1073
|
+
});
|
|
1074
|
+
if (!timeoutHeight) throw new GeneralException(/* @__PURE__ */ new Error("Please provide latestHeight or timeoutHeight"));
|
|
1075
|
+
return timeoutHeight;
|
|
1076
|
+
}
|
|
980
1077
|
resolveTimeoutInBlocks(override) {
|
|
981
1078
|
return typeof override === "number" && Number.isInteger(override) && override > 0 ? override : this.txTimeout;
|
|
982
1079
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./BaseWalletStrategy-D2xNJmzo.js";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-D1ZQcpAC.js";
|
|
3
3
|
export { MsgBroadcaster, MsgBroadcasterOptions, MsgBroadcasterTxOptions, MsgBroadcasterTxOptionsWithAddresses, Web3Broadcaster };
|
package/dist/esm/broadcaster.js
CHANGED
|
@@ -12,6 +12,8 @@ interface MsgBroadcasterTxOptions {
|
|
|
12
12
|
ethereumAddress?: string;
|
|
13
13
|
injectiveAddress?: string;
|
|
14
14
|
accountDetails?: AuthBaseAccount;
|
|
15
|
+
latestHeight?: number | string;
|
|
16
|
+
timeoutHeight?: number | string;
|
|
15
17
|
txTimeoutInBlocks?: number;
|
|
16
18
|
txInclusion?: TxClientInclusionOptions;
|
|
17
19
|
gas?: {
|
|
@@ -27,15 +29,16 @@ interface MsgBroadcasterTxOptionsWithAddresses extends MsgBroadcasterTxOptions {
|
|
|
27
29
|
}
|
|
28
30
|
interface MsgBroadcasterOptions {
|
|
29
31
|
network: Network;
|
|
30
|
-
endpoints?: NetworkEndpoints;
|
|
31
32
|
chainId?: ChainId;
|
|
33
|
+
txTimeout?: number;
|
|
34
|
+
simulateTx?: boolean;
|
|
32
35
|
evmChainId?: EvmChainId;
|
|
33
36
|
feePayerPubKey?: string;
|
|
34
|
-
|
|
35
|
-
txTimeoutOnFeeDelegation?: boolean;
|
|
36
|
-
txTimeout?: number;
|
|
37
|
+
endpoints?: NetworkEndpoints;
|
|
37
38
|
txInclusion?: TxClientInclusionOptions;
|
|
38
39
|
walletStrategy: BaseWalletStrategy;
|
|
40
|
+
useDynamicBaseFee?: boolean;
|
|
41
|
+
txTimeoutOnFeeDelegation?: boolean;
|
|
39
42
|
gasBufferCoefficient?: number;
|
|
40
43
|
httpHeaders?: Record<string, string>;
|
|
41
44
|
}
|
|
@@ -55,6 +58,7 @@ declare class MsgBroadcaster {
|
|
|
55
58
|
chainId: ChainId;
|
|
56
59
|
txTimeout: number;
|
|
57
60
|
simulateTx: boolean;
|
|
61
|
+
useDynamicBaseFee: boolean;
|
|
58
62
|
txTimeoutOnFeeDelegation: boolean;
|
|
59
63
|
evmChainId?: EvmChainId;
|
|
60
64
|
gasBufferCoefficient: number;
|
|
@@ -204,6 +208,8 @@ declare class MsgBroadcaster {
|
|
|
204
208
|
private simulateTxWithSigners;
|
|
205
209
|
private retryOnException;
|
|
206
210
|
private fetchAccountAndBlockDetails;
|
|
211
|
+
private resolveOptionalTimeoutHeight;
|
|
212
|
+
private resolveTimeoutHeight;
|
|
207
213
|
private resolveTimeoutInBlocks;
|
|
208
214
|
private resolveTxInclusionOptions;
|
|
209
215
|
private createTxGrpcApi;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as BaseWalletStrategy } from "./BaseWalletStrategy-D2xNJmzo.js";
|
|
2
|
-
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-
|
|
2
|
+
import { a as MsgBroadcasterTxOptionsWithAddresses, i as MsgBroadcasterTxOptions, n as MsgBroadcaster, r as MsgBroadcasterOptions, t as Web3Broadcaster } from "./index-D1ZQcpAC.js";
|
|
3
3
|
import "./index-DRYular4.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/tx.d.ts
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as MsgBroadcaster, r as checkIfTxRunOutOfGas, t as Web3Broadcaster } from "./broadcaster-
|
|
1
|
+
import { n as MsgBroadcaster, r as checkIfTxRunOutOfGas, t as Web3Broadcaster } from "./broadcaster-DzLAEG3E.js";
|
|
2
2
|
import "./defineProperty-D4YE9KXX.js";
|
|
3
3
|
import { t as BaseWalletStrategy } from "./strategy-DU-V-GfI.js";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-core",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.15",
|
|
4
4
|
"description": "Core wallet strategy",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -84,12 +84,12 @@
|
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@keplr-wallet/types": "^0.12.296",
|
|
86
86
|
"eventemitter3": "^5.0.1",
|
|
87
|
-
"@injectivelabs/exceptions": "1.20.
|
|
88
|
-
"@injectivelabs/
|
|
89
|
-
"@injectivelabs/
|
|
90
|
-
"@injectivelabs/
|
|
91
|
-
"@injectivelabs/
|
|
92
|
-
"@injectivelabs/
|
|
87
|
+
"@injectivelabs/exceptions": "1.20.15",
|
|
88
|
+
"@injectivelabs/sdk-ts": "1.20.15",
|
|
89
|
+
"@injectivelabs/networks": "1.20.15",
|
|
90
|
+
"@injectivelabs/utils": "1.20.15",
|
|
91
|
+
"@injectivelabs/wallet-base": "1.20.15",
|
|
92
|
+
"@injectivelabs/ts-types": "1.20.15"
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|