@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.
@@ -2058,7 +2058,8 @@ function HashPanel({
2058
2058
  chain,
2059
2059
  isOpen,
2060
2060
  onClose,
2061
- zIndex
2061
+ zIndex,
2062
+ error
2062
2063
  }) {
2063
2064
  const [status, setStatus] = (0, import_react7.useState)("confirm");
2064
2065
  const statusMaps = {
@@ -2083,7 +2084,7 @@ function HashPanel({
2083
2084
  color: "#F14141"
2084
2085
  }
2085
2086
  };
2086
- const statusValue = statusMaps[status];
2087
+ const statusValue = error ? statusMaps.fail : statusMaps[status];
2087
2088
  const [shouldRefetch, setShouldRefetch] = (0, import_react7.useState)(true);
2088
2089
  (0, import_react7.useEffect)(() => {
2089
2090
  if (hash) {
@@ -2137,7 +2138,8 @@ function HashPanel({
2137
2138
  hash && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
2138
2139
  "Hash:",
2139
2140
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("a", { href: link, target: "_blank", children: hash })
2140
- ] })
2141
+ ] }),
2142
+ error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "matchid-hashpanel-text", children: error })
2141
2143
  ] }),
2142
2144
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
2143
2145
  ] })
@@ -2434,34 +2436,40 @@ function useWallet() {
2434
2436
  prepareTransactionRequest
2435
2437
  }
2436
2438
  });
2437
- const txHash = await obj.sendRawTransaction({
2438
- serializedTransaction
2439
- });
2440
- addTransaction({
2441
- chainId,
2442
- hash: txHash,
2443
- info: {
2444
- from: evmAccount.address,
2445
- to: restTransaction.to,
2446
- value: (restTransaction.value || 0).toString(),
2447
- input: restTransaction.data,
2448
- timestamp: Math.floor(Date.now() / 1e3).toString(),
2439
+ try {
2440
+ const txHash = await obj.sendRawTransaction({
2441
+ serializedTransaction
2442
+ });
2443
+ addTransaction({
2444
+ chainId,
2449
2445
  hash: txHash,
2450
- source: "local"
2451
- },
2452
- address: evmAccount.address
2453
- });
2454
- modal.show((props) => {
2455
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
2456
- });
2457
- clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
2458
- delete window.matchProvider.transactionMessageIntervalMap[transactionId];
2459
- return txHash;
2446
+ info: {
2447
+ from: evmAccount.address,
2448
+ to: restTransaction.to,
2449
+ value: (restTransaction.value || 0).toString(),
2450
+ input: restTransaction.data,
2451
+ timestamp: Math.floor(Date.now() / 1e3).toString(),
2452
+ hash: txHash,
2453
+ source: "local"
2454
+ },
2455
+ address: evmAccount.address
2456
+ });
2457
+ modal.show((props) => {
2458
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
2459
+ });
2460
+ return txHash;
2461
+ } catch (error) {
2462
+ modal.show((props) => {
2463
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, error: typeof error == "string" ? error : error.details || error.message, chain: _chain });
2464
+ });
2465
+ throw error;
2466
+ }
2460
2467
  } catch (error) {
2461
- console.error("qwe-sign-error", error);
2468
+ console.error("matchid-send-error", error);
2469
+ throw error;
2470
+ } finally {
2462
2471
  clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
2463
2472
  delete window.matchProvider.transactionMessageIntervalMap[transactionId];
2464
- throw error;
2465
2473
  }
2466
2474
  };
2467
2475
  const deployContract = async (parameters2) => {
@@ -3688,7 +3696,7 @@ function StepVerify(props) {
3688
3696
  )
3689
3697
  }
3690
3698
  ) }),
3691
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Button, { disabled: !canContinue, highlight: true, block: true, size: "lg", onClick: onContinue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react_intl8.FormattedMessage, { id: "continue" }) })
3699
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Button, { disabled: !canContinue, loading: submitting, highlight: true, block: true, size: "lg", onClick: onContinue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react_intl8.FormattedMessage, { id: "continue" }) })
3692
3700
  ] });
3693
3701
  }
3694
3702