@keplr-wallet/hooks 0.12.271 → 0.12.273-alpha.0

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.
@@ -11,10 +11,12 @@ const chain_1 = require("./chain");
11
11
  const mobx_1 = require("mobx");
12
12
  const react_1 = require("react");
13
13
  class SenderConfig extends chain_1.TxChainSetter {
14
- constructor(chainGetter, initialChainId, initialSender) {
14
+ constructor(chainGetter, initialChainId, initialSender, initialisEvmOrEthermint) {
15
15
  super(chainGetter, initialChainId);
16
16
  this._value = "";
17
+ this._isEvmOrEthermint = false;
17
18
  this._value = initialSender;
19
+ this._isEvmOrEthermint = initialisEvmOrEthermint;
18
20
  (0, mobx_1.makeObservable)(this);
19
21
  }
20
22
  get sender() {
@@ -26,6 +28,12 @@ class SenderConfig extends chain_1.TxChainSetter {
26
28
  setValue(value) {
27
29
  this._value = value;
28
30
  }
31
+ get isEvmOrEthermint() {
32
+ return this._isEvmOrEthermint;
33
+ }
34
+ setisEvmOrEthermint(value) {
35
+ this._isEvmOrEthermint = value;
36
+ }
29
37
  get uiProperties() {
30
38
  return {};
31
39
  }
@@ -33,14 +41,21 @@ class SenderConfig extends chain_1.TxChainSetter {
33
41
  __decorate([
34
42
  mobx_1.observable
35
43
  ], SenderConfig.prototype, "_value", void 0);
44
+ __decorate([
45
+ mobx_1.observable
46
+ ], SenderConfig.prototype, "_isEvmOrEthermint", void 0);
36
47
  __decorate([
37
48
  mobx_1.action
38
49
  ], SenderConfig.prototype, "setValue", null);
50
+ __decorate([
51
+ mobx_1.action
52
+ ], SenderConfig.prototype, "setisEvmOrEthermint", null);
39
53
  exports.SenderConfig = SenderConfig;
40
- const useSenderConfig = (chainGetter, chainId, sender) => {
41
- const [config] = (0, react_1.useState)(() => new SenderConfig(chainGetter, chainId, sender));
54
+ const useSenderConfig = (chainGetter, chainId, sender, isEvmOrEthermint) => {
55
+ const [config] = (0, react_1.useState)(() => new SenderConfig(chainGetter, chainId, sender, isEvmOrEthermint));
42
56
  config.setChain(chainId);
43
57
  config.setValue(sender);
58
+ config.setisEvmOrEthermint(isEvmOrEthermint);
44
59
  return config;
45
60
  };
46
61
  exports.useSenderConfig = useSenderConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"sender.js","sourceRoot":"","sources":["../../src/tx/sender.ts"],"names":[],"mappings":";;;;;;;;;AACA,mCAAwC;AACxC,+BAA0D;AAE1D,iCAAiC;AAEjC,MAAa,YAAa,SAAQ,qBAAa;IAI7C,YACE,WAAwB,EACxB,cAAsB,EACtB,aAAqB;QAErB,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAP3B,WAAM,GAAW,EAAE,CAAC;QAS5B,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;QAE5B,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAGD,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA9BW;IADT,iBAAU;4CACmB;AAuB9B;IADC,aAAM;4CAGN;AA3BH,oCAgCC;AAEM,MAAM,eAAe,GAAG,CAC7B,WAAwB,EACxB,OAAe,EACf,MAAc,EACd,EAAE;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EACvB,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CACrD,CAAC;IACF,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,eAAe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,EAAE,gBAAgB,CAAC,CACvE,CAAC;IACF,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B"}
@@ -28,6 +28,7 @@ export interface ISenderConfig extends ITxChainSetter {
28
28
  value: string;
29
29
  setValue(value: string): void;
30
30
  sender: string;
31
+ readonly isEvmOrEthermint: boolean;
31
32
  uiProperties: UIProperties;
32
33
  }
33
34
  export interface IFeeConfig extends ITxChainSetter {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tx/types.ts"],"names":[],"mappings":";;;AA2Ha,QAAA,mBAAmB,GAI5B;IACF,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,IAAI;CACX,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tx/types.ts"],"names":[],"mappings":";;;AA4Ha,QAAA,mBAAmB,GAI5B;IACF,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,IAAI;CACX,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { ChainGetter } from "@keplr-wallet/stores";
2
2
  import { QueriesStore } from "./internal";
3
- export declare const useUndelegateTxConfig: (chainGetter: ChainGetter, queriesStore: QueriesStore, chainId: string, sender: string, validatorAddress: string, initialGas: number) => {
3
+ export declare const useUndelegateTxConfig: (chainGetter: ChainGetter, queriesStore: QueriesStore, chainId: string, sender: string, isEvmOrEthermint: boolean, validatorAddress: string, initialGas: number) => {
4
4
  amountConfig: import("./staked-amount").StakedAmountConfig;
5
5
  memoConfig: import("./memo").MemoConfig;
6
6
  gasConfig: import("./gas").GasConfig;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useUndelegateTxConfig = void 0;
4
4
  const index_1 = require("./index");
5
5
  const staked_amount_1 = require("./staked-amount");
6
- const useUndelegateTxConfig = (chainGetter, queriesStore, chainId, sender, validatorAddress, initialGas) => {
7
- const senderConfig = (0, index_1.useSenderConfig)(chainGetter, chainId, sender);
6
+ const useUndelegateTxConfig = (chainGetter, queriesStore, chainId, sender, isEvmOrEthermint, validatorAddress, initialGas) => {
7
+ const senderConfig = (0, index_1.useSenderConfig)(chainGetter, chainId, sender, isEvmOrEthermint);
8
8
  const amountConfig = (0, staked_amount_1.useStakedAmountConfig)(chainGetter, queriesStore, chainId, validatorAddress, senderConfig);
9
9
  const memoConfig = (0, index_1.useMemoConfig)(chainGetter, chainId);
10
10
  const gasConfig = (0, index_1.useGasConfig)(chainGetter, chainId, initialGas);
@@ -1 +1 @@
1
- {"version":3,"file":"undelegate-tx.js","sourceRoot":"","sources":["../../src/tx/undelegate-tx.ts"],"names":[],"mappings":";;;AACA,mCAMiB;AACjB,mDAAwD;AAGjD,MAAM,qBAAqB,GAAG,CACnC,WAAwB,EACxB,YAA0B,EAC1B,OAAe,EACf,MAAc,EACd,gBAAwB,EACxB,UAAkB,EAClB,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG,IAAA,qCAAqB,EACxC,WAAW,EACX,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,YAAY,CACb,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,IAAA,oBAAY,EAC5B,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,SAAS,EACT;QACE,uBAAuB,EA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AAM,SAAS,GAAG,IAAA,oBAAY,EAC5B,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,SAAS,EACT;QACE,uBAAuB,EAAE,KAAK;KAC/B,CACF,CAAC;IACF,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAErC,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,SAAS,CAAC,YAAY,EAAE;QAC1B,eAAe,CAAC,eAAe,CAAC,SAAS,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;KAC7E;IACD,eAAe,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC3C,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IAEtE,OAAO;QACL,YAAY;QACZ,UAAU;QACV,SAAS;QACT,SAAS;QACT,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,qBAAqB,yBAsDhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/hooks",
3
- "version": "0.12.271",
3
+ "version": "0.12.273-alpha.0",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -18,17 +18,17 @@
18
18
  "dependencies": {
19
19
  "@ethersproject/address": "^5.7.0",
20
20
  "@ethersproject/providers": "^5.7.0",
21
- "@keplr-wallet/background": "0.12.271",
22
- "@keplr-wallet/common": "0.12.271",
23
- "@keplr-wallet/cosmos": "0.12.271",
24
- "@keplr-wallet/crypto": "0.12.271",
25
- "@keplr-wallet/proto-types": "0.12.271",
26
- "@keplr-wallet/simple-fetch": "0.12.271",
27
- "@keplr-wallet/stores": "0.12.271",
28
- "@keplr-wallet/stores-etc": "0.12.271",
29
- "@keplr-wallet/stores-eth": "0.12.271",
30
- "@keplr-wallet/types": "0.12.271",
31
- "@keplr-wallet/unit": "0.12.271",
21
+ "@keplr-wallet/background": "0.12.273-alpha.0",
22
+ "@keplr-wallet/common": "0.12.273-alpha.0",
23
+ "@keplr-wallet/cosmos": "0.12.273-alpha.0",
24
+ "@keplr-wallet/crypto": "0.12.273-alpha.0",
25
+ "@keplr-wallet/proto-types": "0.12.273-alpha.0",
26
+ "@keplr-wallet/simple-fetch": "0.12.273-alpha.0",
27
+ "@keplr-wallet/stores": "0.12.273-alpha.0",
28
+ "@keplr-wallet/stores-etc": "0.12.273-alpha.0",
29
+ "@keplr-wallet/stores-eth": "0.12.273-alpha.0",
30
+ "@keplr-wallet/types": "0.12.273-alpha.0",
31
+ "@keplr-wallet/unit": "0.12.273-alpha.0",
32
32
  "buffer": "^6.0.3",
33
33
  "long": "^4.0.0",
34
34
  "utility-types": "^3.10.0"
@@ -38,5 +38,5 @@
38
38
  "mobx-utils": "^6",
39
39
  "react": "^16.8.0 || ^17 || ^18"
40
40
  },
41
- "gitHead": "7aa962fc78035488affaf8557981578dfcbd1408"
41
+ "gitHead": "82f54a8d233e1084d89b95acfb17affb888694ed"
42
42
  }
@@ -26,6 +26,7 @@ export const useIBCTransferConfig = (
26
26
  queriesStore: IQueriesStore,
27
27
  chainId: string,
28
28
  sender: string,
29
+ isEvmOrEthermint: boolean,
29
30
  initialGas: number,
30
31
  options: {
31
32
  allowHexAddressToBech32Address?: boolean;
@@ -37,7 +38,12 @@ export const useIBCTransferConfig = (
37
38
  ) => {
38
39
  const channelConfig = useIBCChannelConfig();
39
40
 
40
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
41
+ const senderConfig = useSenderConfig(
42
+ chainGetter,
43
+ chainId,
44
+ sender,
45
+ isEvmOrEthermint
46
+ );
41
47
 
42
48
  const amountConfig = useIBCAmountConfig(
43
49
  chainGetter,
@@ -85,6 +91,7 @@ export const useSendMixedIBCTransferConfig = (
85
91
  queriesStore: IQueriesStore,
86
92
  chainId: string,
87
93
  sender: string,
94
+ isEvmOrEthermint: boolean,
88
95
  initialGas: number,
89
96
  isIBCTransfer: boolean,
90
97
  options: {
@@ -102,7 +109,12 @@ export const useSendMixedIBCTransferConfig = (
102
109
  ) => {
103
110
  const channelConfig = useIBCChannelConfig(!isIBCTransfer);
104
111
 
105
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
112
+ const senderConfig = useSenderConfig(
113
+ chainGetter,
114
+ chainId,
115
+ sender,
116
+ isEvmOrEthermint
117
+ );
106
118
 
107
119
  const amountConfig = useIBCAmountConfig(
108
120
  chainGetter,
@@ -15,11 +15,17 @@ export const useDelegateTxConfig = (
15
15
  queriesStore: QueriesStore,
16
16
  chainId: string,
17
17
  sender: string,
18
+ isEvmOrEthermint: boolean,
18
19
  validatorAddress: string,
19
20
  initialGas: number,
20
21
  fractionSubFeeWeight?: number
21
22
  ) => {
22
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
23
+ const senderConfig = useSenderConfig(
24
+ chainGetter,
25
+ chainId,
26
+ sender,
27
+ isEvmOrEthermint
28
+ );
23
29
  const amountConfig = useAmountConfig(
24
30
  chainGetter,
25
31
  queriesStore,
package/src/tx/fee.ts CHANGED
@@ -184,12 +184,7 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
184
184
 
185
185
  @computed
186
186
  get selectableFeeCurrencies(): FeeCurrency[] {
187
- if (
188
- this.chainInfo.bip44.coinType === 60 ||
189
- this.chainInfo.hasFeature("eth-address-gen") ||
190
- this.chainInfo.hasFeature("eth-key-sign") ||
191
- ("evm" in this.chainInfo && this.chainInfo.evm)
192
- ) {
187
+ if (this.senderConfig.isEvmOrEthermint) {
193
188
  return this.chainInfo.feeCurrencies.slice(0, 1);
194
189
  }
195
190
 
@@ -255,6 +250,13 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
255
250
  });
256
251
  }
257
252
  } else if (this.canFeeMarketTxFeesAndReady()) {
253
+ if (this.chainInfo.hasFeature("initia-dynamicfee")) {
254
+ return this.chainInfo.feeCurrencies.slice(0, 1);
255
+ }
256
+ if (this.chainInfo.hasFeature("evm-feemarket")) {
257
+ return this.chainInfo.feeCurrencies.slice(0, 1);
258
+ }
259
+
258
260
  const queryCosmos = this.queriesStore.get(this.chainId).cosmos;
259
261
  if (queryCosmos) {
260
262
  const gasPrices = queryCosmos.queryFeeMarketGasPrices.gasPrices;
@@ -475,6 +477,19 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
475
477
  ) != null
476
478
  );
477
479
  }
480
+ if (this.chainInfo.hasFeature("evm-feemarket")) {
481
+ const queries = this.queriesStore.get(this.chainId);
482
+ if (!queries.cosmos) {
483
+ console.log(
484
+ "Chain has evm-feemarket feature. But no cosmos queries provided."
485
+ );
486
+ return false;
487
+ }
488
+ const queryEvmFeeMarketBaseFee = queries.cosmos.queryEvmFeeMarketBaseFee;
489
+
490
+ return queryEvmFeeMarketBaseFee.baseFee != null;
491
+ }
492
+
478
493
  if (this.chainInfo.hasFeature("initia-dynamicfee")) {
479
494
  const queries = this.queriesStore.get(this.chainId);
480
495
  if (!queries.keplrETC) {
@@ -678,64 +693,7 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
678
693
  if (queryEtc) {
679
694
  const gasPrice = queryEtc.queryInitiaDynamicFee.baseGasPrice;
680
695
  if (gasPrice) {
681
- let multiplication = {
682
- low: 1.1,
683
- average: 1.2,
684
- high: 1.3,
685
- };
686
-
687
- const multificationConfig =
688
- this.queriesStore.simpleQuery.queryGet<{
689
- [str: string]:
690
- | {
691
- low: number;
692
- average: number;
693
- high: number;
694
- }
695
- | undefined;
696
- }>(
697
- "https://gjsttg7mkgtqhjpt3mv5aeuszi0zblbb.lambda-url.us-west-2.on.aws",
698
- "/feemarket/info.json"
699
- );
700
-
701
- if (multificationConfig.response) {
702
- const _default =
703
- multificationConfig.response.data["__default__"];
704
- if (
705
- _default &&
706
- _default.low != null &&
707
- typeof _default.low === "number" &&
708
- _default.average != null &&
709
- typeof _default.average === "number" &&
710
- _default.high != null &&
711
- typeof _default.high === "number"
712
- ) {
713
- multiplication = {
714
- low: _default.low,
715
- average: _default.average,
716
- high: _default.high,
717
- };
718
- }
719
- const specific =
720
- multificationConfig.response.data[
721
- this.chainInfo.chainIdentifier
722
- ];
723
- if (
724
- specific &&
725
- specific.low != null &&
726
- typeof specific.low === "number" &&
727
- specific.average != null &&
728
- typeof specific.average === "number" &&
729
- specific.high != null &&
730
- typeof specific.high === "number"
731
- ) {
732
- multiplication = {
733
- low: specific.low,
734
- average: specific.average,
735
- high: specific.high,
736
- };
737
- }
738
- }
696
+ const multiplication = this.getMultiplication();
739
697
  switch (feeType) {
740
698
  case "low":
741
699
  return new Dec(multiplication.low).mul(new Dec(gasPrice));
@@ -746,6 +704,22 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
746
704
  }
747
705
  }
748
706
  }
707
+ } else if (this.chainInfo.hasFeature("evm-feemarket")) {
708
+ const queryCosmos = this.queriesStore.get(this.chainId).cosmos;
709
+ if (queryCosmos) {
710
+ const baseFee = queryCosmos.queryEvmFeeMarketBaseFee.baseFee;
711
+ if (baseFee && baseFee.amount) {
712
+ const multiplication = this.getMultiplication();
713
+ switch (feeType) {
714
+ case "low":
715
+ return new Dec(multiplication.low).mul(baseFee.amount);
716
+ case "average":
717
+ return new Dec(multiplication.average).mul(baseFee.amount);
718
+ case "high":
719
+ return new Dec(multiplication.high).mul(baseFee.amount);
720
+ }
721
+ }
722
+ }
749
723
  } else {
750
724
  const queryCosmos = this.queriesStore.get(this.chainId).cosmos;
751
725
  if (queryCosmos) {
@@ -755,64 +729,7 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
755
729
  (gasPrice) => gasPrice.denom === feeCurrency.coinMinimalDenom
756
730
  );
757
731
  if (gasPrice) {
758
- let multiplication = {
759
- low: 1.1,
760
- average: 1.2,
761
- high: 1.3,
762
- };
763
-
764
- const multificationConfig =
765
- this.queriesStore.simpleQuery.queryGet<{
766
- [str: string]:
767
- | {
768
- low: number;
769
- average: number;
770
- high: number;
771
- }
772
- | undefined;
773
- }>(
774
- "https://gjsttg7mkgtqhjpt3mv5aeuszi0zblbb.lambda-url.us-west-2.on.aws",
775
- "/feemarket/info.json"
776
- );
777
-
778
- if (multificationConfig.response) {
779
- const _default =
780
- multificationConfig.response.data["__default__"];
781
- if (
782
- _default &&
783
- _default.low != null &&
784
- typeof _default.low === "number" &&
785
- _default.average != null &&
786
- typeof _default.average === "number" &&
787
- _default.high != null &&
788
- typeof _default.high === "number"
789
- ) {
790
- multiplication = {
791
- low: _default.low,
792
- average: _default.average,
793
- high: _default.high,
794
- };
795
- }
796
- const specific =
797
- multificationConfig.response.data[
798
- this.chainInfo.chainIdentifier
799
- ];
800
- if (
801
- specific &&
802
- specific.low != null &&
803
- typeof specific.low === "number" &&
804
- specific.average != null &&
805
- typeof specific.average === "number" &&
806
- specific.high != null &&
807
- typeof specific.high === "number"
808
- ) {
809
- multiplication = {
810
- low: specific.low,
811
- average: specific.average,
812
- high: specific.high,
813
- };
814
- }
815
- }
732
+ const multiplication = this.getMultiplication();
816
733
  switch (feeType) {
817
734
  case "low":
818
735
  return new Dec(multiplication.low).mul(gasPrice.amount);
@@ -1067,6 +984,26 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
1067
984
  };
1068
985
  }
1069
986
  }
987
+ } else if (this.chainInfo.hasFeature("evm-feemarket")) {
988
+ const queryCosmos = this.queriesStore.get(this.chainId).cosmos;
989
+ if (queryCosmos) {
990
+ const queryEvmFeeMarketBaseFee = queryCosmos.queryEvmFeeMarketBaseFee;
991
+ if (queryEvmFeeMarketBaseFee.error) {
992
+ return {
993
+ warning: new Error("Failed to fetch base fee"),
994
+ };
995
+ }
996
+ if (!queryEvmFeeMarketBaseFee.response) {
997
+ return {
998
+ loadingState: "loading-block",
999
+ };
1000
+ }
1001
+ if (queryEvmFeeMarketBaseFee.isFetching) {
1002
+ return {
1003
+ loadingState: "loading",
1004
+ };
1005
+ }
1006
+ }
1070
1007
  } else {
1071
1008
  const queryCosmos = this.queriesStore.get(this.chainId).cosmos;
1072
1009
  if (queryCosmos) {
@@ -1280,6 +1217,65 @@ export class FeeConfig extends TxChainSetter implements IFeeConfig {
1280
1217
 
1281
1218
  return {};
1282
1219
  }
1220
+
1221
+ private getMultiplication(): { low: number; average: number; high: number } {
1222
+ let multiplication = {
1223
+ low: 1.1,
1224
+ average: 1.2,
1225
+ high: 1.3,
1226
+ };
1227
+
1228
+ const multificationConfig = this.queriesStore.simpleQuery.queryGet<{
1229
+ [str: string]:
1230
+ | {
1231
+ low: number;
1232
+ average: number;
1233
+ high: number;
1234
+ }
1235
+ | undefined;
1236
+ }>(
1237
+ "https://gjsttg7mkgtqhjpt3mv5aeuszi0zblbb.lambda-url.us-west-2.on.aws",
1238
+ "/feemarket/info.json"
1239
+ );
1240
+
1241
+ if (multificationConfig.response) {
1242
+ const _default = multificationConfig.response.data["__default__"];
1243
+ if (
1244
+ _default &&
1245
+ _default.low != null &&
1246
+ typeof _default.low === "number" &&
1247
+ _default.average != null &&
1248
+ typeof _default.average === "number" &&
1249
+ _default.high != null &&
1250
+ typeof _default.high === "number"
1251
+ ) {
1252
+ multiplication = {
1253
+ low: _default.low,
1254
+ average: _default.average,
1255
+ high: _default.high,
1256
+ };
1257
+ }
1258
+ const specific =
1259
+ multificationConfig.response.data[this.chainInfo.chainIdentifier];
1260
+ if (
1261
+ specific &&
1262
+ specific.low != null &&
1263
+ typeof specific.low === "number" &&
1264
+ specific.average != null &&
1265
+ typeof specific.average === "number" &&
1266
+ specific.high != null &&
1267
+ typeof specific.high === "number"
1268
+ ) {
1269
+ multiplication = {
1270
+ low: specific.low,
1271
+ average: specific.average,
1272
+ high: specific.high,
1273
+ };
1274
+ }
1275
+ }
1276
+
1277
+ return multiplication;
1278
+ }
1283
1279
  }
1284
1280
 
1285
1281
  export const useFeeConfig = (
@@ -12,7 +12,9 @@ export type QueriesStore = IQueriesStore<
12
12
  Partial<EthereumQueries> & {
13
13
  cosmos?: Pick<
14
14
  CosmosQueriesImpl,
15
- "queryDelegations" | "queryFeeMarketGasPrices"
15
+ | "queryDelegations"
16
+ | "queryFeeMarketGasPrices"
17
+ | "queryEvmFeeMarketBaseFee"
16
18
  >;
17
19
  } & {
18
20
  keplrETC?: Pick<
@@ -180,6 +180,7 @@ export class RecipientConfig
180
180
  const isEvmChain = !!this.chainInfo.evm;
181
181
  const hasEthereumAddress =
182
182
  chainInfo.bip44.coinType === 60 ||
183
+ chainInfo.alternativeBIP44s?.find((bip44) => bip44.coinType === 60) ||
183
184
  !!chainInfo.features?.includes("eth-address-gen") ||
184
185
  !!chainInfo.features?.includes("eth-key-sign") ||
185
186
  isEvmChain;
@@ -14,10 +14,16 @@ export const useRedelegateTxConfig = (
14
14
  queriesStore: QueriesStore,
15
15
  chainId: string,
16
16
  sender: string,
17
+ isEvmOrEthermint: boolean,
17
18
  validatorAddress: string,
18
19
  initialGas: number
19
20
  ) => {
20
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
21
+ const senderConfig = useSenderConfig(
22
+ chainGetter,
23
+ chainId,
24
+ sender,
25
+ isEvmOrEthermint
26
+ );
21
27
  const amountConfig = useStakedAmountConfig(
22
28
  chainGetter,
23
29
  queriesStore,
package/src/tx/send-tx.ts CHANGED
@@ -14,6 +14,7 @@ export const useSendTxConfig = (
14
14
  queriesStore: QueriesStore,
15
15
  chainId: string,
16
16
  sender: string,
17
+ isEvmOrEthermint: boolean,
17
18
  initialGas: number,
18
19
  options: {
19
20
  allowHexAddressToBech32Address?: boolean;
@@ -27,7 +28,12 @@ export const useSendTxConfig = (
27
28
  computeTerraClassicTax?: boolean;
28
29
  } = {}
29
30
  ) => {
30
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
31
+ const senderConfig = useSenderConfig(
32
+ chainGetter,
33
+ chainId,
34
+ sender,
35
+ isEvmOrEthermint
36
+ );
31
37
 
32
38
  const amountConfig = useAmountConfig(
33
39
  chainGetter,
package/src/tx/sender.ts CHANGED
@@ -7,15 +7,19 @@ import { useState } from "react";
7
7
  export class SenderConfig extends TxChainSetter implements ISenderConfig {
8
8
  @observable
9
9
  protected _value: string = "";
10
+ @observable
11
+ protected _isEvmOrEthermint: boolean = false;
10
12
 
11
13
  constructor(
12
14
  chainGetter: ChainGetter,
13
15
  initialChainId: string,
14
- initialSender: string
16
+ initialSender: string,
17
+ initialisEvmOrEthermint: boolean
15
18
  ) {
16
19
  super(chainGetter, initialChainId);
17
20
 
18
21
  this._value = initialSender;
22
+ this._isEvmOrEthermint = initialisEvmOrEthermint;
19
23
 
20
24
  makeObservable(this);
21
25
  }
@@ -33,6 +37,15 @@ export class SenderConfig extends TxChainSetter implements ISenderConfig {
33
37
  this._value = value;
34
38
  }
35
39
 
40
+ get isEvmOrEthermint(): boolean {
41
+ return this._isEvmOrEthermint;
42
+ }
43
+
44
+ @action
45
+ setisEvmOrEthermint(value: boolean) {
46
+ this._isEvmOrEthermint = value;
47
+ }
48
+
36
49
  get uiProperties(): UIProperties {
37
50
  return {};
38
51
  }
@@ -41,13 +54,15 @@ export class SenderConfig extends TxChainSetter implements ISenderConfig {
41
54
  export const useSenderConfig = (
42
55
  chainGetter: ChainGetter,
43
56
  chainId: string,
44
- sender: string
57
+ sender: string,
58
+ isEvmOrEthermint: boolean
45
59
  ) => {
46
60
  const [config] = useState(
47
- () => new SenderConfig(chainGetter, chainId, sender)
61
+ () => new SenderConfig(chainGetter, chainId, sender, isEvmOrEthermint)
48
62
  );
49
63
  config.setChain(chainId);
50
64
  config.setValue(sender);
65
+ config.setisEvmOrEthermint(isEvmOrEthermint);
51
66
 
52
67
  return config;
53
68
  };
package/src/tx/types.ts CHANGED
@@ -42,6 +42,7 @@ export interface ISenderConfig extends ITxChainSetter {
42
42
  setValue(value: string): void;
43
43
 
44
44
  sender: string;
45
+ readonly isEvmOrEthermint: boolean;
45
46
 
46
47
  uiProperties: UIProperties;
47
48
  }
@@ -14,10 +14,16 @@ export const useUndelegateTxConfig = (
14
14
  queriesStore: QueriesStore,
15
15
  chainId: string,
16
16
  sender: string,
17
+ isEvmOrEthermint: boolean,
17
18
  validatorAddress: string,
18
19
  initialGas: number
19
20
  ) => {
20
- const senderConfig = useSenderConfig(chainGetter, chainId, sender);
21
+ const senderConfig = useSenderConfig(
22
+ chainGetter,
23
+ chainId,
24
+ sender,
25
+ isEvmOrEthermint
26
+ );
21
27
  const amountConfig = useStakedAmountConfig(
22
28
  chainGetter,
23
29
  queriesStore,