carbon-js-sdk 0.3.29 → 0.3.30-beta.1

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/lib/CarbonSDK.js CHANGED
@@ -106,11 +106,6 @@ class CarbonSDK {
106
106
  blockchain: blockchain_1.Blockchain.BinanceSmartChain,
107
107
  tokenClient: this.token,
108
108
  });
109
- this.arbitrum = clients_1.ETHClient.instance({
110
- configProvider: this,
111
- blockchain: blockchain_1.Blockchain.Arbitrum,
112
- tokenClient: this.token,
113
- });
114
109
  this.zil = clients_1.ZILClient.instance({
115
110
  configProvider: this,
116
111
  blockchain: blockchain_1.Blockchain.Zilliqa,
@@ -4,4 +4,9 @@ export declare const DEFAULT_FEE_DENOM = "swth";
4
4
  export declare const DEFAULT_GAS_PRICE: BigNumber;
5
5
  export declare const DEFAULT_GAS: BigNumber;
6
6
  export declare const DEFAULT_FEE: StdFee;
7
- export declare const CURRENT_GAS_PRICE = 769.23077;
7
+ export interface GasPriceStep {
8
+ low: number;
9
+ average: number;
10
+ high: number;
11
+ }
12
+ export declare const CARBON_GAS_PRICE: GasPriceStep;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CURRENT_GAS_PRICE = exports.DEFAULT_FEE = exports.DEFAULT_GAS = exports.DEFAULT_GAS_PRICE = exports.DEFAULT_FEE_DENOM = void 0;
6
+ exports.CARBON_GAS_PRICE = exports.DEFAULT_FEE = exports.DEFAULT_GAS = exports.DEFAULT_GAS_PRICE = exports.DEFAULT_FEE_DENOM = void 0;
7
7
  const proto_signing_1 = require("@cosmjs/proto-signing");
8
8
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
9
  exports.DEFAULT_FEE_DENOM = "swth";
@@ -15,4 +15,8 @@ exports.DEFAULT_FEE = {
15
15
  amount: proto_signing_1.coins(exports.DEFAULT_GAS_PRICE.times(exports.DEFAULT_GAS).dp(0).toString(), "swth"),
16
16
  gas: exports.DEFAULT_GAS.toString(10),
17
17
  };
18
- exports.CURRENT_GAS_PRICE = 769.23077;
18
+ exports.CARBON_GAS_PRICE = {
19
+ low: 1,
20
+ average: 1.5,
21
+ high: 2,
22
+ };
@@ -1,5 +1,6 @@
1
1
  import { SimpleMap } from "../util/type";
2
2
  import { AppCurrency, Bech32Config, ChainInfo } from "@keplr-wallet/types";
3
+ import { GasPriceStep } from "./generic";
3
4
  export interface ChainInfoExplorerTmRpc extends ChainInfo {
4
5
  explorerUrlToTx: string;
5
6
  tmRpc?: string;
@@ -69,9 +70,4 @@ export declare const cibtIbcTokenRegex: RegExp;
69
70
  export declare const ibcTokenRegex: RegExp;
70
71
  export declare const ibcNetworkRegex: RegExp;
71
72
  export declare const ibcDefaultGas: number;
72
- export interface GasPriceStep {
73
- low: number;
74
- average: number;
75
- high: number;
76
- }
77
73
  export declare const DefaultGasPriceStep: GasPriceStep;
@@ -149,13 +149,13 @@ exports.EmbedChainInfosInit = {
149
149
  coinMinimalDenom: "uosmo",
150
150
  coinDecimals: 6,
151
151
  coinGeckoId: "osmosis",
152
+ gasPriceStep: {
153
+ low: 0,
154
+ average: 0.025,
155
+ high: 0.04,
156
+ },
152
157
  },
153
158
  ],
154
- gasPriceStep: {
155
- low: 0,
156
- average: 0.025,
157
- high: 0.04,
158
- },
159
159
  features: ["ibc-transfer", "ibc-go"],
160
160
  explorerUrlToTx: "https://www.mintscan.io/osmosis/txs/{txHash}",
161
161
  tmRpc: "https://rpc-osmosis.blockapsis.com/",
@@ -237,19 +237,24 @@ exports.EmbedChainInfosInit = {
237
237
  coinMinimalDenom: "uluna",
238
238
  coinDecimals: 6,
239
239
  coinGeckoId: "terra-luna",
240
+ gasPriceStep: {
241
+ low: 0.15,
242
+ average: 0.2,
243
+ high: 0.25,
244
+ },
240
245
  },
241
246
  {
242
247
  coinDenom: "UST",
243
248
  coinMinimalDenom: "uusd",
244
249
  coinDecimals: 6,
245
250
  coinGeckoId: "terrausd",
251
+ gasPriceStep: {
252
+ low: 0.15,
253
+ average: 0.2,
254
+ high: 0.25,
255
+ },
246
256
  },
247
257
  ],
248
- gasPriceStep: {
249
- low: 0.15,
250
- average: 0.2,
251
- high: 0.25,
252
- },
253
258
  features: ["ibc-transfer", "ibc-go"],
254
259
  explorerUrlToTx: "https://finder.terra.money/columbus-5/tx/{txHash}",
255
260
  tmRpc: "https://terra-rpc.easy2stake.com/",
@@ -565,13 +570,13 @@ exports.EmbedChainInfosInit = {
565
570
  coinMinimalDenom: "ungm",
566
571
  coinDecimals: 6,
567
572
  coinGeckoId: "e-money",
573
+ gasPriceStep: {
574
+ low: 1,
575
+ average: 1,
576
+ high: 1,
577
+ },
568
578
  },
569
579
  ],
570
- gasPriceStep: {
571
- low: 1,
572
- average: 1,
573
- high: 1,
574
- },
575
580
  features: ["ibc-transfer", "ibc-go"],
576
581
  explorerUrlToTx: "https://emoney.bigdipper.live/transactions/{txHash}",
577
582
  },
@@ -604,13 +609,13 @@ exports.EmbedChainInfosInit = {
604
609
  coinMinimalDenom: "ujuno",
605
610
  coinDecimals: 6,
606
611
  coinGeckoId: "juno-network",
612
+ gasPriceStep: {
613
+ low: 0.001,
614
+ average: 0.0025,
615
+ high: 0.004,
616
+ },
607
617
  },
608
618
  ],
609
- gasPriceStep: {
610
- low: 0.001,
611
- average: 0.0025,
612
- high: 0.004,
613
- },
614
619
  features: ["ibc-transfer", "ibc-go"],
615
620
  explorerUrlToTx: "https://www.mintscan.io/juno/txs/{txHash}",
616
621
  },
@@ -643,13 +648,13 @@ exports.EmbedChainInfosInit = {
643
648
  coinMinimalDenom: "aevmos",
644
649
  coinDecimals: 18,
645
650
  coinGeckoId: "evmos",
651
+ gasPriceStep: {
652
+ low: 25000000000,
653
+ average: 25000000000,
654
+ high: 40000000000,
655
+ },
646
656
  },
647
657
  ],
648
- gasPriceStep: {
649
- low: 25000000000,
650
- average: 25000000000,
651
- high: 40000000000,
652
- },
653
658
  features: ["ibc-transfer", "ibc-go"],
654
659
  explorerUrlToTx: "https://www.mintscan.io/evmos/txs/{txHash}",
655
660
  },
@@ -889,13 +894,13 @@ exports.EmbedChainInfosInit = {
889
894
  coinMinimalDenom: "umed",
890
895
  coinDecimals: 6,
891
896
  coinGeckoId: "medibloc",
897
+ gasPriceStep: {
898
+ low: 5,
899
+ average: 7,
900
+ high: 9,
901
+ },
892
902
  },
893
903
  ],
894
- gasPriceStep: {
895
- low: 5,
896
- average: 7,
897
- high: 9,
898
- },
899
904
  features: ["ibc-transfer", "ibc-go"],
900
905
  explorerUrlToTx: "https://www.mintscan.io/medibloc/txs/{txHash}",
901
906
  tmRpc: "https://rpc.gopanacea.org/",
@@ -964,13 +969,13 @@ exports.EmbedChainInfosInit = {
964
969
  coinMinimalDenom: "ucmdx",
965
970
  coinDecimals: 6,
966
971
  coinGeckoId: "comdex",
972
+ gasPriceStep: {
973
+ "low": 0.0125,
974
+ "average": 0.025,
975
+ "high": 0.04
976
+ },
967
977
  },
968
978
  ],
969
- gasPriceStep: {
970
- "low": 0.0125,
971
- "average": 0.025,
972
- "high": 0.04
973
- },
974
979
  features: ["ibc-transfer", "ibc-go"],
975
980
  explorerUrlToTx: "https://www.mintscan.io/comdex/txs/{txHash}",
976
981
  tmRpc: "https://rpc.comdex.one/",
@@ -1004,13 +1009,13 @@ exports.EmbedChainInfosInit = {
1004
1009
  coinMinimalDenom: "ncheq",
1005
1010
  coinDecimals: 9,
1006
1011
  coinGeckoId: "cheqd-network",
1012
+ gasPriceStep: {
1013
+ low: 25,
1014
+ average: 30,
1015
+ high: 50,
1016
+ },
1007
1017
  },
1008
1018
  ],
1009
- gasPriceStep: {
1010
- low: 25,
1011
- average: 30,
1012
- high: 50,
1013
- },
1014
1019
  features: ["ibc-transfer", "ibc-go"],
1015
1020
  explorerUrlToTx: "https://explorer.cheqd.io/transactions/{txHash}",
1016
1021
  tmRpc: "https://rpc.cheqd.net/",
@@ -1079,13 +1084,13 @@ exports.EmbedChainInfosInit = {
1079
1084
  coinMinimalDenom: "uhuahua",
1080
1085
  coinDecimals: 6,
1081
1086
  coinGeckoId: "pool:uhuahua",
1087
+ gasPriceStep: {
1088
+ low: 0.025,
1089
+ average: 0.03,
1090
+ high: 0.035,
1091
+ },
1082
1092
  },
1083
1093
  ],
1084
- gasPriceStep: {
1085
- low: 0.025,
1086
- average: 0.03,
1087
- high: 0.035,
1088
- },
1089
1094
  features: ["ibc-transfer", "ibc-go"],
1090
1095
  explorerUrlToTx: "https://ping.pub/chihuahua/tx/{txHash}",
1091
1096
  },
@@ -1225,13 +1230,13 @@ exports.EmbedChainInfosInit = {
1225
1230
  coinMinimalDenom: "udig",
1226
1231
  coinDecimals: 6,
1227
1232
  coinGeckoId: "pool:udig",
1233
+ gasPriceStep: {
1234
+ low: 0.025,
1235
+ average: 0.03,
1236
+ high: 0.035,
1237
+ },
1228
1238
  },
1229
1239
  ],
1230
- gasPriceStep: {
1231
- low: 0.025,
1232
- average: 0.03,
1233
- high: 0.035,
1234
- },
1235
1240
  features: ["ibc-transfer", "ibc-go"],
1236
1241
  explorerUrlToTx: "https://ping.pub/dig/tx/{txHash}",
1237
1242
  tmRpc: "https://rpc-1-dig.notional.ventures/",
@@ -1445,13 +1450,13 @@ exports.EmbedChainInfosInit = {
1445
1450
  coinMinimalDenom: "ugraviton",
1446
1451
  coinDecimals: 6,
1447
1452
  coinGeckoId: "pool:ugraviton",
1453
+ gasPriceStep: {
1454
+ low: 0,
1455
+ average: 0,
1456
+ high: 0.035,
1457
+ },
1448
1458
  },
1449
1459
  ],
1450
- gasPriceStep: {
1451
- low: 0,
1452
- average: 0,
1453
- high: 0.035,
1454
- },
1455
1460
  features: ["ibc-transfer", "ibc-go"],
1456
1461
  explorerUrlToTx: "https://www.mintscan.io/gravity-bridge/txs/{txHash}",
1457
1462
  tmRpc: "https://gravitychain.io:26657/",
@@ -1533,13 +1538,9 @@ exports.EmbedChainInfosInit = {
1533
1538
  coinMinimalDenom: "swth",
1534
1539
  coinDecimals: 8,
1535
1540
  coinGeckoId: "switcheo",
1541
+ gasPriceStep: generic_1.CARBON_GAS_PRICE,
1536
1542
  },
1537
1543
  ],
1538
- gasPriceStep: {
1539
- low: generic_1.CURRENT_GAS_PRICE,
1540
- average: generic_1.CURRENT_GAS_PRICE,
1541
- high: generic_1.CURRENT_GAS_PRICE,
1542
- },
1543
1544
  bip44: { coinType: 118 },
1544
1545
  currencies: [
1545
1546
  {
@@ -1560,7 +1561,7 @@ exports.EmbedChainInfosInit = {
1560
1561
  chainName: "Carbon",
1561
1562
  chainId: "carbon-1",
1562
1563
  bech32Config: exports.IBCAddress.defaultBech32Config("swth"),
1563
- features: ["stargate", "ibc-transfer", "ibc-go"],
1564
+ features: ["ibc-transfer", "ibc-go"],
1564
1565
  explorerUrlToTx: "https://scan.carbon.network/transaction/{txHash}?net=main",
1565
1566
  },
1566
1567
  [ChainIds.Axelar]: {
@@ -1569,14 +1570,14 @@ exports.EmbedChainInfosInit = {
1569
1570
  coinDenom: "AXL",
1570
1571
  coinMinimalDenom: "uaxl",
1571
1572
  coinDecimals: 6,
1572
- coinGeckoId: "", // TODO: fill in when available
1573
+ coinGeckoId: "",
1574
+ gasPriceStep: {
1575
+ low: 0.007,
1576
+ average: 0.007,
1577
+ high: 0.01,
1578
+ },
1573
1579
  },
1574
1580
  ],
1575
- gasPriceStep: {
1576
- low: 0.007,
1577
- average: 0.007,
1578
- high: 0.01,
1579
- },
1580
1581
  bip44: { coinType: 118 },
1581
1582
  currencies: [
1582
1583
  {
@@ -1655,13 +1656,13 @@ exports.EmbedChainInfosInit = {
1655
1656
  coinMinimalDenom: "ustrd",
1656
1657
  coinDecimals: 6,
1657
1658
  coinGeckoId: "stride",
1659
+ gasPriceStep: {
1660
+ low: 0,
1661
+ average: 0,
1662
+ high: 0.04,
1663
+ },
1658
1664
  },
1659
1665
  ],
1660
- gasPriceStep: {
1661
- low: 0,
1662
- average: 0,
1663
- high: 0.04,
1664
- },
1665
1666
  features: ["ibc-transfer", "ibc-go"],
1666
1667
  explorerUrlToTx: "https://www.mintscan.io/stride/txs/{txHash}",
1667
1668
  tmRpc: "https://stride.rpc.kjnodes.com/",
@@ -1701,13 +1702,13 @@ exports.EmbedChainInfosInit = {
1701
1702
  coinMinimalDenom: "ukuji",
1702
1703
  coinDecimals: 6,
1703
1704
  coinGeckoId: "kujira",
1705
+ gasPriceStep: {
1706
+ low: 0.01,
1707
+ average: 0.025,
1708
+ high: 0.03,
1709
+ },
1704
1710
  },
1705
1711
  ],
1706
- gasPriceStep: {
1707
- low: 0.01,
1708
- average: 0.025,
1709
- high: 0.03,
1710
- },
1711
1712
  features: ["ibc-transfer", "ibc-go"],
1712
1713
  explorerUrlToTx: "https://finder.kujira.app/kaiyo-1/tx/{txHash}",
1713
1714
  },
@@ -1717,23 +1718,21 @@ exports.EmbedChainInfosInit = {
1717
1718
  chainId: "phoenix-1",
1718
1719
  chainName: "Terra 2.0",
1719
1720
  bip44: {
1720
- coinType: 118,
1721
+ coinType: 330,
1721
1722
  },
1722
1723
  bech32Config: exports.IBCAddress.defaultBech32Config("terra"),
1723
1724
  stakeCurrency: {
1724
1725
  coinDenom: "LUNA",
1725
1726
  coinMinimalDenom: "uluna",
1726
1727
  coinDecimals: 6,
1727
- // coinGeckoId: "terra-luna-2",
1728
- coinGeckoId: "pool:uluna",
1728
+ coinGeckoId: "terra-luna-2",
1729
1729
  },
1730
1730
  currencies: [
1731
1731
  {
1732
1732
  coinDenom: "LUNA",
1733
1733
  coinMinimalDenom: "uluna",
1734
1734
  coinDecimals: 6,
1735
- // coinGeckoId: "terra-luna-2",
1736
- coinGeckoId: "pool:uluna",
1735
+ coinGeckoId: "terra-luna-2",
1737
1736
  },
1738
1737
  ],
1739
1738
  feeCurrencies: [
@@ -1741,16 +1740,15 @@ exports.EmbedChainInfosInit = {
1741
1740
  coinDenom: "LUNA",
1742
1741
  coinMinimalDenom: "uluna",
1743
1742
  coinDecimals: 6,
1744
- // coinGeckoId: "terra-luna-2",
1745
- coinGeckoId: "pool:uluna",
1743
+ coinGeckoId: "terra-luna-2",
1744
+ gasPriceStep: {
1745
+ low: 0.15,
1746
+ average: 0.2,
1747
+ high: 0.25,
1748
+ },
1746
1749
  },
1747
1750
  ],
1748
- gasPriceStep: {
1749
- low: 0.15,
1750
- average: 0.2,
1751
- high: 0.25,
1752
- },
1753
- features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
1751
+ features: ["ibc-transfer", "ibc-go"],
1754
1752
  explorerUrlToTx: "https://finder.terra.money/phoenix-1/tx/{txHash}",
1755
1753
  },
1756
1754
  [ChainIds.Quicksilver]: {
@@ -1779,14 +1777,14 @@ exports.EmbedChainInfosInit = {
1779
1777
  coinDenom: "QCK",
1780
1778
  coinMinimalDenom: "uqck",
1781
1779
  coinDecimals: 6,
1780
+ gasPriceStep: {
1781
+ low: 0,
1782
+ average: 0.0001,
1783
+ high: 0.00025,
1784
+ },
1782
1785
  },
1783
1786
  ],
1784
- gasPriceStep: {
1785
- low: 0,
1786
- average: 0.0001,
1787
- high: 0.00025,
1788
- },
1789
- features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
1787
+ features: ["ibc-transfer", "ibc-go"],
1790
1788
  explorerUrlToTx: "https://www.mintscan.io/quicksilver/txs/{txHash}",
1791
1789
  },
1792
1790
  [ChainIds.StafiHub]: {
@@ -1830,14 +1828,14 @@ exports.EmbedChainInfosInit = {
1830
1828
  coinDenom: "FIS",
1831
1829
  coinMinimalDenom: "ufis",
1832
1830
  coinDecimals: 6,
1831
+ gasPriceStep: {
1832
+ low: 0.01,
1833
+ average: 0.025,
1834
+ high: 0.04
1835
+ },
1833
1836
  }
1834
1837
  ],
1835
- gasPriceStep: {
1836
- low: 0.01,
1837
- average: 0.025,
1838
- high: 0.04
1839
- },
1840
- features: ["ibc-transfer", "ibc-go", "no-legacy-stdTx"],
1838
+ features: ["ibc-transfer", "ibc-go"],
1841
1839
  explorerUrlToTx: "https://www.mintscan.io/stafi/txs/{txHash}",
1842
1840
  }
1843
1841
  };
@@ -1,5 +1,6 @@
1
1
  import { OptionalNetworkMap, SimpleMap } from "../util/type";
2
2
  import BigNumber from "bignumber.js";
3
+ export declare const decTypeDecimals = 18;
3
4
  export declare const DenomPrefix: {
4
5
  LPToken: string;
5
6
  CDPToken: string;
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TokenBlacklist = exports.CoinGeckoTokenNames = exports.CommonAssetName = exports.uscUsdValue = exports.DenomPrefix = void 0;
6
+ exports.TokenBlacklist = exports.CoinGeckoTokenNames = exports.CommonAssetName = exports.uscUsdValue = exports.DenomPrefix = exports.decTypeDecimals = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const network_1 = require("./network");
9
+ exports.decTypeDecimals = 18;
9
10
  exports.DenomPrefix = {
10
11
  LPToken: "clpt",
11
12
  CDPToken: "cibt",
@@ -1,5 +1,5 @@
1
1
  import { CarbonSigner } from "../../wallet";
2
- import { AppCurrency, ChainInfo, Keplr, Key } from "@keplr-wallet/types";
2
+ import { AppCurrency, ChainInfo, FeeCurrency, Keplr, Key } from "@keplr-wallet/types";
3
3
  import SDKProvider from "../sdk";
4
4
  declare class KeplrAccount {
5
5
  static SWTH_CURRENCY: AppCurrency;
@@ -8,17 +8,12 @@ declare class KeplrAccount {
8
8
  readonly coinType: number;
9
9
  };
10
10
  readonly currencies: readonly [];
11
- readonly feeCurrencies: readonly [{
12
- coinDenom: string;
13
- coinMinimalDenom: string;
14
- coinDecimals: number;
15
- coinGeckoId: string;
16
- }];
11
+ readonly feeCurrencies: readonly [FeeCurrency];
17
12
  readonly gasPriceStep: {
18
- readonly low: 1;
19
- readonly average: 1.5;
20
- readonly high: 2;
21
- };
13
+ readonly low: number;
14
+ readonly average: number;
15
+ readonly high: number;
16
+ } | undefined;
22
17
  };
23
18
  static createKeplrSigner(keplr: Keplr, chainInfo: ChainInfo, account: Key): CarbonSigner;
24
19
  static getChainInfo(configProvider: SDKProvider): Promise<ChainInfo>;
@@ -17,6 +17,7 @@ const SWTH = {
17
17
  coinMinimalDenom: "swth",
18
18
  coinDecimals: 8,
19
19
  coinGeckoId: "switcheo",
20
+ gasPriceStep: constant_1.CARBON_GAS_PRICE,
20
21
  };
21
22
  class KeplrAccount {
22
23
  static createKeplrSigner(keplr, chainInfo, account) {
@@ -51,21 +52,30 @@ class KeplrAccount {
51
52
  const tokenClient = configProvider.getTokenClient();
52
53
  const coingeckoIdMap = tokenClient.geckoTokenNames;
53
54
  const feeCurrencies = gasPricesResult.minGasPrices.reduce((result, price) => {
54
- var _a;
55
+ var _a, _b, _c;
55
56
  const token = tokenClient.tokenForDenom(price.denom);
56
57
  if (!token || token.denom === 'swth')
57
58
  return result;
59
+ // Check if gas price is valid, else add default
60
+ const gasPriceAdjusted = util_1.NumberUtils.bnOrZero(price.gasPrice).shiftedBy(-constant_1.decTypeDecimals);
61
+ const minGasPrice = gasPriceAdjusted.isNaN() || gasPriceAdjusted.isZero()
62
+ ? ((_b = (_a = KeplrAccount.BASE_CHAIN_INFO.gasPriceStep) === null || _a === void 0 ? void 0 : _a.low) !== null && _b !== void 0 ? _b : constant_1.CARBON_GAS_PRICE.low)
63
+ : gasPriceAdjusted.toNumber();
58
64
  result.push({
59
- coinDenom: (_a = token.symbol) !== null && _a !== void 0 ? _a : token.denom,
65
+ coinDenom: (_c = token.symbol) !== null && _c !== void 0 ? _c : token.denom,
60
66
  coinMinimalDenom: token.denom,
61
67
  coinDecimals: token.decimals.toNumber(),
62
68
  coinGeckoId: coingeckoIdMap[token.denom],
69
+ gasPriceStep: {
70
+ low: minGasPrice,
71
+ average: minGasPrice,
72
+ high: minGasPrice,
73
+ },
63
74
  });
64
75
  return result;
65
76
  }, []);
66
77
  return {
67
78
  feeCurrencies: [KeplrAccount.SWTH_CURRENCY, ...feeCurrencies],
68
- gasPriceStep: KeplrAccount.BASE_CHAIN_INFO.gasPriceStep,
69
79
  bip44: KeplrAccount.BASE_CHAIN_INFO.bip44,
70
80
  currencies: [KeplrAccount.SWTH_CURRENCY, ...feeCurrencies],
71
81
  stakeCurrency: KeplrAccount.SWTH_CURRENCY,
@@ -81,7 +91,7 @@ class KeplrAccount {
81
91
  bech32PrefixConsAddr: `${bech32Prefix}valcons`,
82
92
  bech32PrefixConsPub: `${bech32Prefix}valconspub`,
83
93
  },
84
- features: ["stargate", "ibc-transfer", "ibc-go"],
94
+ features: ["ibc-transfer", "ibc-go"],
85
95
  };
86
96
  });
87
97
  }
@@ -91,10 +101,6 @@ KeplrAccount.BASE_CHAIN_INFO = {
91
101
  bip44: { coinType: util_1.AddressUtils.SWTHAddress.coinType() },
92
102
  currencies: [],
93
103
  feeCurrencies: [SWTH],
94
- gasPriceStep: {
95
- low: 1,
96
- average: 1.5,
97
- high: 2,
98
- },
104
+ gasPriceStep: SWTH.gasPriceStep,
99
105
  };
100
106
  exports.default = KeplrAccount;
@@ -1,6 +1,6 @@
1
1
  import { CarbonSigner } from "../../wallet";
2
2
  import { Leap } from "@cosmos-kit/leap";
3
- import { AppCurrency, ChainInfo } from "@keplr-wallet/types";
3
+ import { AppCurrency, ChainInfo, FeeCurrency } from "@keplr-wallet/types";
4
4
  import SDKProvider from "../sdk";
5
5
  declare class LeapAccount {
6
6
  static SWTH_CURRENCY: AppCurrency;
@@ -9,17 +9,12 @@ declare class LeapAccount {
9
9
  readonly coinType: number;
10
10
  };
11
11
  readonly currencies: readonly [];
12
- readonly feeCurrencies: readonly [{
13
- coinDenom: string;
14
- coinMinimalDenom: string;
15
- coinDecimals: number;
16
- coinGeckoId: string;
17
- }];
12
+ readonly feeCurrencies: readonly [FeeCurrency];
18
13
  readonly gasPriceStep: {
19
- readonly low: 1;
20
- readonly average: 1.5;
21
- readonly high: 2;
22
- };
14
+ readonly low: number;
15
+ readonly average: number;
16
+ readonly high: number;
17
+ } | undefined;
23
18
  };
24
19
  static createLeapSigner(leap: Leap, chainId: string): CarbonSigner;
25
20
  static getChainId(configProvider: SDKProvider): Promise<string>;
@@ -17,6 +17,7 @@ const SWTH = {
17
17
  coinMinimalDenom: "swth",
18
18
  coinDecimals: 8,
19
19
  coinGeckoId: "switcheo",
20
+ gasPriceStep: constant_1.CARBON_GAS_PRICE,
20
21
  };
21
22
  class LeapAccount {
22
23
  static createLeapSigner(leap, chainId) {
@@ -58,21 +59,30 @@ class LeapAccount {
58
59
  const tokenClient = configProvider.getTokenClient();
59
60
  const coingeckoIdMap = tokenClient.geckoTokenNames;
60
61
  const feeCurrencies = gasPricesResult.minGasPrices.reduce((result, price) => {
61
- var _a;
62
+ var _a, _b, _c;
62
63
  const token = tokenClient.tokenForDenom(price.denom);
63
64
  if (!token || token.denom === 'swth')
64
65
  return result;
66
+ // Check if gas price is valid, else add default
67
+ const gasPriceAdjusted = util_1.NumberUtils.bnOrZero(price.gasPrice).shiftedBy(-constant_1.decTypeDecimals);
68
+ const minGasPrice = gasPriceAdjusted.isNaN() || gasPriceAdjusted.isZero()
69
+ ? ((_b = (_a = LeapAccount.BASE_CHAIN_INFO.gasPriceStep) === null || _a === void 0 ? void 0 : _a.low) !== null && _b !== void 0 ? _b : constant_1.CARBON_GAS_PRICE.low)
70
+ : gasPriceAdjusted.toNumber();
65
71
  result.push({
66
- coinDenom: (_a = token.symbol) !== null && _a !== void 0 ? _a : token.denom,
72
+ coinDenom: (_c = token.symbol) !== null && _c !== void 0 ? _c : token.denom,
67
73
  coinMinimalDenom: token.denom,
68
74
  coinDecimals: token.decimals.toNumber(),
69
75
  coinGeckoId: coingeckoIdMap[token.denom],
76
+ gasPriceStep: {
77
+ low: minGasPrice,
78
+ average: minGasPrice,
79
+ high: minGasPrice,
80
+ },
70
81
  });
71
82
  return result;
72
83
  }, []);
73
84
  return {
74
85
  feeCurrencies: [LeapAccount.SWTH_CURRENCY, ...feeCurrencies],
75
- gasPriceStep: LeapAccount.BASE_CHAIN_INFO.gasPriceStep,
76
86
  bip44: LeapAccount.BASE_CHAIN_INFO.bip44,
77
87
  currencies: [LeapAccount.SWTH_CURRENCY, ...feeCurrencies],
78
88
  stakeCurrency: LeapAccount.SWTH_CURRENCY,
@@ -98,10 +108,6 @@ LeapAccount.BASE_CHAIN_INFO = {
98
108
  bip44: { coinType: util_1.AddressUtils.SWTHAddress.coinType() },
99
109
  currencies: [],
100
110
  feeCurrencies: [SWTH],
101
- gasPriceStep: {
102
- low: 1,
103
- average: 1.5,
104
- high: 2,
105
- },
111
+ gasPriceStep: SWTH.gasPriceStep,
106
112
  };
107
113
  exports.default = LeapAccount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.3.29",
3
+ "version": "0.3.30-beta.1+d163b8329b32",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,12 +44,13 @@
44
44
  "@cosmjs/stargate": "^0.28.10",
45
45
  "@cosmos-kit/leap": "^0.13.14",
46
46
  "@grpc/grpc-js": "^1.3.2",
47
- "@keplr-wallet/stores": "^0.10.24",
48
- "@keplr-wallet/types": "^0.10.24",
49
- "@ledgerhq/hw-app-eth": "^6.11.2",
50
- "@ledgerhq/hw-transport": "^6.3.0",
51
- "@ledgerhq/hw-transport-webhid": "^6.4.1",
52
- "@ledgerhq/hw-transport-webusb": "^6.3.0",
47
+ "@keplr-wallet/stores": "^0.10.25-rc.0",
48
+ "@keplr-wallet/types": "^0.10.25-rc.0",
49
+ "@ledgerhq/cryptoassets": "^7.2.0",
50
+ "@ledgerhq/hw-app-eth": "^6.20.0",
51
+ "@ledgerhq/hw-transport": "^6.20.0",
52
+ "@ledgerhq/hw-transport-webhid": "^6.20.0",
53
+ "@ledgerhq/hw-transport-webusb": "^6.20.0",
53
54
  "@zilliqa-js/zilliqa": "^2.2.0",
54
55
  "base58check": "^2.0.0",
55
56
  "bignumber.js": "^9.0.1",