@matchain/matchid-sdk-react 0.1.55-alpha.0 → 0.1.55-alpha.2

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.
@@ -2,15 +2,15 @@ import {
2
2
  bind_exports,
3
3
  poh_exports,
4
4
  user_exports
5
- } from "../../chunk-N7NX7Q7M.mjs";
5
+ } from "../../chunk-BQERJULN.mjs";
6
6
  import {
7
7
  isSuccess,
8
8
  wallet_exports
9
- } from "../../chunk-36M5ROJI.mjs";
9
+ } from "../../chunk-WZQ56L5F.mjs";
10
+ import "../../chunk-JX73EY6V.mjs";
10
11
  import "../../chunk-UA6XHZHX.mjs";
11
12
  import "../../chunk-IZOOVZAD.mjs";
12
13
  import "../../chunk-FKXS2XRG.mjs";
13
- import "../../chunk-JX73EY6V.mjs";
14
14
  import "../../chunk-J5LGTIGS.mjs";
15
15
  export {
16
16
  bind_exports as bind,
@@ -1111,7 +1111,8 @@ function HashPanel({
1111
1111
  chain,
1112
1112
  isOpen,
1113
1113
  onClose,
1114
- zIndex
1114
+ zIndex,
1115
+ error
1115
1116
  }) {
1116
1117
  const [status, setStatus] = (0, import_react13.useState)("confirm");
1117
1118
  const statusMaps = {
@@ -1136,7 +1137,7 @@ function HashPanel({
1136
1137
  color: "#F14141"
1137
1138
  }
1138
1139
  };
1139
- const statusValue = statusMaps[status];
1140
+ const statusValue = error ? statusMaps.fail : statusMaps[status];
1140
1141
  const [shouldRefetch, setShouldRefetch] = (0, import_react13.useState)(true);
1141
1142
  (0, import_react13.useEffect)(() => {
1142
1143
  if (hash) {
@@ -1190,7 +1191,8 @@ function HashPanel({
1190
1191
  hash && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
1191
1192
  "Hash:",
1192
1193
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("a", { href: link, target: "_blank", children: hash })
1193
- ] })
1194
+ ] }),
1195
+ error && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "matchid-hashpanel-text", children: error })
1194
1196
  ] }),
1195
1197
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
1196
1198
  ] })
@@ -2398,34 +2400,40 @@ function useWallet() {
2398
2400
  prepareTransactionRequest
2399
2401
  }
2400
2402
  });
2401
- const txHash = await obj.sendRawTransaction({
2402
- serializedTransaction
2403
- });
2404
- addTransaction({
2405
- chainId,
2406
- hash: txHash,
2407
- info: {
2408
- from: evmAccount.address,
2409
- to: restTransaction.to,
2410
- value: (restTransaction.value || 0).toString(),
2411
- input: restTransaction.data,
2412
- timestamp: Math.floor(Date.now() / 1e3).toString(),
2403
+ try {
2404
+ const txHash = await obj.sendRawTransaction({
2405
+ serializedTransaction
2406
+ });
2407
+ addTransaction({
2408
+ chainId,
2413
2409
  hash: txHash,
2414
- source: "local"
2415
- },
2416
- address: evmAccount.address
2417
- });
2418
- modal.show((props) => {
2419
- return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
2420
- });
2421
- clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
2422
- delete window.matchProvider.transactionMessageIntervalMap[transactionId];
2423
- return txHash;
2410
+ info: {
2411
+ from: evmAccount.address,
2412
+ to: restTransaction.to,
2413
+ value: (restTransaction.value || 0).toString(),
2414
+ input: restTransaction.data,
2415
+ timestamp: Math.floor(Date.now() / 1e3).toString(),
2416
+ hash: txHash,
2417
+ source: "local"
2418
+ },
2419
+ address: evmAccount.address
2420
+ });
2421
+ modal.show((props) => {
2422
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
2423
+ });
2424
+ return txHash;
2425
+ } catch (error) {
2426
+ modal.show((props) => {
2427
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, error: typeof error == "string" ? error : error.details || error.message, chain: _chain });
2428
+ });
2429
+ throw error;
2430
+ }
2424
2431
  } catch (error) {
2425
- console.error("qwe-sign-error", error);
2432
+ console.error("matchid-send-error", error);
2433
+ throw error;
2434
+ } finally {
2426
2435
  clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
2427
2436
  delete window.matchProvider.transactionMessageIntervalMap[transactionId];
2428
- throw error;
2429
2437
  }
2430
2438
  };
2431
2439
  const deployContract = async (parameters2) => {