@mictonode/widget 0.3.15 → 0.3.16

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.
@@ -1,4 +1,4 @@
1
- import { _ as n, s as e } from "./main-3096050c.js";
1
+ import { _ as n, s as e } from "./main-d0e5d1e4.js";
2
2
  class l {
3
3
  constructor({
4
4
  requestClient: i
@@ -1,4 +1,4 @@
1
- import { C as u, m as r, T as W, t as ee, f as ie, L as d, P as L, A as p, a as B, b as F, c as w, d as M, e as U, g as Q, h as oe, _ as ne } from "./main-3096050c.js";
1
+ import { C as u, m as r, T as W, t as ee, f as ie, L as d, P as L, A as p, a as B, b as F, c as w, d as M, e as U, g as Q, h as oe, _ as ne } from "./main-d0e5d1e4.js";
2
2
  function Z() {
3
3
  return {
4
4
  positionId: d.UZERO,
@@ -1,4 +1,4 @@
1
- import { _ as n, M as r, i as c, m as t, j as a, k as d, l as h, n as l, o as g, p, q as u, r as m } from "./main-3096050c.js";
1
+ import { _ as n, M as r, i as c, m as t, j as a, k as d, l as h, n as l, o as g, p, q as u, r as m } from "./main-d0e5d1e4.js";
2
2
  class f {
3
3
  constructor(e) {
4
4
  n(this, "rpc", void 0), this.rpc = e, this.createPosition = this.createPosition.bind(this), this.withdrawPosition = this.withdrawPosition.bind(this), this.collectFees = this.collectFees.bind(this), this.collectIncentives = this.collectIncentives.bind(this), this.fungifyChargedPositions = this.fungifyChargedPositions.bind(this);
@@ -10,7 +10,7 @@ import {
10
10
  getTxByHash,
11
11
  } from '../../utils/http';
12
12
  import { BroadcastMode, Coin, CoinMetadata } from '../../utils/type';
13
- import { WalletName, readWallet } from '../../../lib/wallet/Wallet';
13
+ import { WalletName, readWallet, isEvmChain } from '../../../lib/wallet/Wallet';
14
14
  import { UniClient } from '../../../lib/wallet/UniClient';
15
15
 
16
16
  // cosmos sdk messages
@@ -149,6 +149,10 @@ async function initData() {
149
149
  }
150
150
  getLatestBlock(props.endpoint).then((x) => {
151
151
  chainId.value = x.block.header.chain_id;
152
+ // Set higher default fee for EVM chains (Warden, Evmos, etc.)
153
+ if (isEvmChain(chainId.value) && feeAmount.value < 250000) {
154
+ feeAmount.value = 250000;
155
+ }
152
156
  });
153
157
 
154
158
  // Every sub component should have a initial function
@@ -87,6 +87,15 @@ export function keyType(chainId: string) {
87
87
  }
88
88
  }
89
89
 
90
+ // Check if chain is EVM-based (requires higher fees)
91
+ export function isEvmChain(chainId: string): boolean {
92
+ return chainId.startsWith("warden") ||
93
+ chainId.startsWith("barra") ||
94
+ chainId.search(/\w+_\d+-\d+/g) > -1 ||
95
+ chainId.startsWith("injective") ||
96
+ chainId.startsWith("stratos");
97
+ }
98
+
90
99
  export function readWallet(hdPath?: string) {
91
100
  return JSON.parse(
92
101
  localStorage.getItem(hdPath || DEFAULT_HDPATH) || '{}'
@@ -104,7 +113,7 @@ export function extractChainId(chainId: string) {
104
113
  const start = chainId.indexOf('_')
105
114
  const end = chainId.indexOf('-')
106
115
  if (end > start && start > 0) {
107
- return Number(chainId.substring(start + 1, end))
116
+ return Number(chainId.substring(start + 1, end))
108
117
  }
109
118
  return 0
110
119
  }
@@ -125,9 +134,9 @@ export function createWallet(name: WalletName, arg: WalletArgument, registry?: R
125
134
  case WalletName.MetamaskSnap:
126
135
  return new MetamaskSnapWallet(arg, reg)
127
136
  case WalletName.Metamask:
128
- return arg.hdPath &&
129
- (arg.hdPath.startsWith('m/44/60') || arg.hdPath.startsWith("m/44'/60"))
130
- ? new MetamaskWallet(arg, reg) : new MetamaskSnapWallet(arg, reg)
137
+ return arg.hdPath &&
138
+ (arg.hdPath.startsWith('m/44/60') || arg.hdPath.startsWith("m/44'/60"))
139
+ ? new MetamaskWallet(arg, reg) : new MetamaskSnapWallet(arg, reg)
131
140
  }
132
141
  throw new Error("No wallet connected")
133
142
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mictonode/widget",
3
3
  "private": false,
4
- "version": "0.3.15",
4
+ "version": "0.3.16",
5
5
  "type": "module",
6
6
  "main": "dist/ping-widget.js",
7
7
  "author": {