@bze/bze-ui-kit 1.0.15 → 1.0.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.
package/dist/index.d.mts CHANGED
@@ -1267,15 +1267,15 @@ declare enum TxStatus {
1267
1267
  Broadcasting = "Transaction Pending"
1268
1268
  }
1269
1269
  declare const useSDKTx: (chainName?: string) => {
1270
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1270
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1271
1271
  progressTrack: string;
1272
1272
  };
1273
1273
  declare const useBZETx: () => {
1274
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1274
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1275
1275
  progressTrack: string;
1276
1276
  };
1277
1277
  declare const useIBCTx: (chainName?: string) => {
1278
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1278
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1279
1279
  progressTrack: string;
1280
1280
  };
1281
1281
 
package/dist/index.d.ts CHANGED
@@ -1267,15 +1267,15 @@ declare enum TxStatus {
1267
1267
  Broadcasting = "Transaction Pending"
1268
1268
  }
1269
1269
  declare const useSDKTx: (chainName?: string) => {
1270
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1270
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1271
1271
  progressTrack: string;
1272
1272
  };
1273
1273
  declare const useBZETx: () => {
1274
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1274
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1275
1275
  progressTrack: string;
1276
1276
  };
1277
1277
  declare const useIBCTx: (chainName?: string) => {
1278
- tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<void>;
1278
+ tx: (msgs: EncodeObject[], options?: TxOptions | undefined) => Promise<boolean>;
1279
1279
  progressTrack: string;
1280
1280
  };
1281
1281
 
package/dist/index.js CHANGED
@@ -4499,18 +4499,19 @@ var useTx = (chainName) => {
4499
4499
  }
4500
4500
  }, [simulateFee]);
4501
4501
  const tx = (0, import_react18.useCallback)(async (msgs, options) => {
4502
- var _a2;
4502
+ var _a2, _b2;
4503
4503
  if (!address) {
4504
4504
  toast.error("Transaction Failed" /* Failed */, "Please connect the wallet");
4505
- return;
4505
+ return false;
4506
4506
  }
4507
4507
  if (!await canUseClient()) {
4508
4508
  toast.error("Transaction Failed" /* Failed */, "Can not find suitable signing client. Make sure your wallet is installed, connected and unlocked.");
4509
4509
  disconnect();
4510
- return;
4510
+ return false;
4511
4511
  }
4512
4512
  setProgressTrack("Getting fee");
4513
4513
  const broadcastToastId = toast.loading("Transaction Pending" /* Broadcasting */, "Waiting for transaction to be signed and included in block");
4514
+ let success = false;
4514
4515
  if (signingClient) {
4515
4516
  try {
4516
4517
  const fee = await getFee(msgs, options);
@@ -4520,6 +4521,7 @@ var useTx = (chainName) => {
4520
4521
  const resp = await broadcastResult.wait();
4521
4522
  const txHash = (resp == null ? void 0 : resp.txhash) || broadcastResult.transactionHash;
4522
4523
  if ((resp == null ? void 0 : resp.code) === 0) {
4524
+ success = true;
4523
4525
  setProgressTrack("Transaction sent");
4524
4526
  toast.clickableSuccess("Transaction Successful" /* Successful */, () => {
4525
4527
  openExternalLink(`${getChainExplorerURL(chainName != null ? chainName : defaultChainName)}/tx/${txHash}`);
@@ -4536,12 +4538,19 @@ var useTx = (chainName) => {
4536
4538
  }
4537
4539
  } catch (e) {
4538
4540
  console.error(e);
4539
- if (e.message.includes("Failed to retrieve account from signer")) {
4541
+ const errMsg = (_b2 = e == null ? void 0 : e.message) != null ? _b2 : "";
4542
+ const isSignerError = [
4543
+ "Failed to retrieve account from signer",
4544
+ "Signer address does not match",
4545
+ "signers mismatch",
4546
+ "Signer mismatched"
4547
+ ].some((pattern) => errMsg.includes(pattern));
4548
+ if (isSignerError) {
4540
4549
  disconnect();
4541
4550
  }
4542
- toast.error("Transaction Failed" /* Failed */, prettyError(e == null ? void 0 : e.message));
4551
+ toast.error("Transaction Failed" /* Failed */, prettyError(errMsg));
4543
4552
  if (options == null ? void 0 : options.onFailure) {
4544
- options.onFailure(prettyError(e == null ? void 0 : e.message) || "Unknown error");
4553
+ options.onFailure(prettyError(errMsg) || "Unknown error");
4545
4554
  }
4546
4555
  }
4547
4556
  }
@@ -4549,6 +4558,7 @@ var useTx = (chainName) => {
4549
4558
  setTimeout(() => {
4550
4559
  setProgressTrack("");
4551
4560
  }, (options == null ? void 0 : options.progressTrackerTimeout) || 5e3);
4561
+ return success;
4552
4562
  }, [address, canUseClient, toast, signingClient, disconnect, getFee, chainName, defaultChainName]);
4553
4563
  return {
4554
4564
  tx,