@babylonlabs-io/wallet-connector 1.0.13 → 1.0.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/index.es.js CHANGED
@@ -114480,25 +114480,30 @@ class OKXBabylonProvider {
114480
114480
  if (!this.chainId) throw new Error("Chain ID is not initialized");
114481
114481
  if (!this.rpc) throw new Error("RPC URL is not initialized");
114482
114482
  if (!this.wallet.keplr) throw new Error("OKX Wallet extension not found");
114483
+ const t = "3.50.0", n = await this.wallet.getVersion();
114484
+ if (n && n < t)
114485
+ throw new Error(
114486
+ `OKX Wallet version ${n} is not compatible. Please update to version ${t} or higher.`
114487
+ );
114483
114488
  try {
114484
114489
  await this.wallet.keplr.enable(this.chainId);
114485
- } catch (d) {
114486
- if (d != null && d.message.includes(this.chainId))
114490
+ } catch (A) {
114491
+ if (A != null && A.message.includes(this.chainId))
114487
114492
  try {
114488
114493
  await this.wallet.keplr.experimentalSuggestChain(this.chainData), await this.wallet.keplr.enable(this.chainId);
114489
114494
  } catch {
114490
114495
  throw new Error("Failed to add BBN chain");
114491
114496
  }
114492
114497
  else
114493
- throw d != null && d.message.includes("rejected") ? new Error("OKX Wallet connection request rejected") : d != null && d.message.includes("context invalidated") ? new Error("OKX Wallet extension context invalidated") : new Error((d == null ? void 0 : d.message) || "Failed to connect to OKX Wallet");
114498
+ throw A != null && A.message.includes("rejected") ? new Error("OKX Wallet connection request rejected") : A != null && A.message.includes("context invalidated") ? new Error("OKX Wallet extension context invalidated") : new Error((A == null ? void 0 : A.message) || "Failed to connect to OKX Wallet");
114494
114499
  }
114495
- const t = await this.wallet.keplr.getKey(this.chainId);
114496
- if (!t) throw new Error("Failed to get OKX Wallet key");
114497
- const { bech32Address: n, pubKey: a } = t;
114498
- if (n && a)
114500
+ const a = await this.wallet.keplr.getKey(this.chainId);
114501
+ if (!a) throw new Error("Failed to get OKX Wallet key");
114502
+ const { bech32Address: d, pubKey: c } = a;
114503
+ if (d && c)
114499
114504
  this.walletInfo = {
114500
- publicKeyHex: Buffer$1$1.from(t.pubKey).toString("hex"),
114501
- address: n
114505
+ publicKeyHex: Buffer$1$1.from(a.pubKey).toString("hex"),
114506
+ address: d
114502
114507
  };
114503
114508
  else
114504
114509
  throw new Error("Could not connect to OKX Wallet");
@@ -114535,6 +114540,9 @@ class OKXBabylonProvider {
114535
114540
  throw new Error("Failed to get offline signer auto");
114536
114541
  }
114537
114542
  }
114543
+ getVersion() {
114544
+ return this.wallet.getVersion();
114545
+ }
114538
114546
  }
114539
114547
  const metadata$8 = {
114540
114548
  id: "okx",