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

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.
@@ -13,7 +13,7 @@ import {
13
13
  useTransaction,
14
14
  useUserInfo,
15
15
  useWallet
16
- } from "../chunk-36M5ROJI.mjs";
16
+ } from "../chunk-SKA35IYC.mjs";
17
17
  import "../chunk-UA6XHZHX.mjs";
18
18
  import "../chunk-IZOOVZAD.mjs";
19
19
  import "../chunk-FKXS2XRG.mjs";
@@ -12,6 +12,7 @@ type HashPanelProps = {
12
12
  isOpen: boolean;
13
13
  onClose: () => void;
14
14
  zIndex?: number;
15
+ error?: string;
15
16
  };
16
17
  declare function export_default(props: HashPanelProps): false | react_jsx_runtime.JSX.Element;
17
18
 
@@ -12,6 +12,7 @@ type HashPanelProps = {
12
12
  isOpen: boolean;
13
13
  onClose: () => void;
14
14
  zIndex?: number;
15
+ error?: string;
15
16
  };
16
17
  declare function export_default(props: HashPanelProps): false | react_jsx_runtime.JSX.Element;
17
18
 
package/dist/index.css CHANGED
@@ -1074,7 +1074,7 @@ body {
1074
1074
  height: 96px;
1075
1075
  }
1076
1076
 
1077
- .matchid-hashpanel-hash {
1077
+ .matchid-hashpanel-hash,.matchid-hashpanel-text {
1078
1078
  width: 100%;
1079
1079
  font-size: 14px;
1080
1080
  word-break: break-all;
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import React, { ReactNode } from 'react';
8
8
  import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CXzZS0eM.mjs';
9
9
  export { i as Hooks, M as ModalProvider, T as ToastProvider } from './index-CqKohtvj.mjs';
10
10
  export { i as Components } from './index-a_Qt7NXk.mjs';
11
- export { i as UI } from './index-MsSYZS38.mjs';
11
+ export { i as UI } from './index-CB6ZNvzn.mjs';
12
12
  export { i as Api } from './index-G15A08DI.mjs';
13
13
  export { i as Chains } from './index-DXRGMAbv.mjs';
14
14
  export { i as Types } from './index-6-oVBXRP.mjs';
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import React, { ReactNode } from 'react';
8
8
  import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CXzZS0eM.js';
9
9
  export { i as Hooks, M as ModalProvider, T as ToastProvider } from './index-CPPDmmz8.js';
10
10
  export { i as Components } from './index-CNH7a3bx.js';
11
- export { i as UI } from './index-Es7yJi7T.js';
11
+ export { i as UI } from './index-6kXyNEXB.js';
12
12
  export { i as Api } from './index-Y5WRoqzn.js';
13
13
  export { i as Chains } from './index-DXRGMAbv.js';
14
14
  export { i as Types } from './index-CMH6Jesl.js';
package/dist/index.js CHANGED
@@ -5722,7 +5722,8 @@ function HashPanel({
5722
5722
  chain,
5723
5723
  isOpen,
5724
5724
  onClose,
5725
- zIndex
5725
+ zIndex,
5726
+ error
5726
5727
  }) {
5727
5728
  const [status, setStatus] = (0, import_react28.useState)("confirm");
5728
5729
  const statusMaps = {
@@ -5747,7 +5748,7 @@ function HashPanel({
5747
5748
  color: "#F14141"
5748
5749
  }
5749
5750
  };
5750
- const statusValue = statusMaps[status];
5751
+ const statusValue = error ? statusMaps.fail : statusMaps[status];
5751
5752
  const [shouldRefetch, setShouldRefetch] = (0, import_react28.useState)(true);
5752
5753
  (0, import_react28.useEffect)(() => {
5753
5754
  if (hash) {
@@ -5801,7 +5802,8 @@ function HashPanel({
5801
5802
  hash && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
5802
5803
  "Hash:",
5803
5804
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("a", { href: link, target: "_blank", children: hash })
5804
- ] })
5805
+ ] }),
5806
+ error && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "matchid-hashpanel-text", children: error })
5805
5807
  ] }),
5806
5808
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
5807
5809
  ] })
@@ -6172,34 +6174,40 @@ function useWallet() {
6172
6174
  prepareTransactionRequest
6173
6175
  }
6174
6176
  });
6175
- const txHash = await obj.sendRawTransaction({
6176
- serializedTransaction
6177
- });
6178
- addTransaction({
6179
- chainId,
6180
- hash: txHash,
6181
- info: {
6182
- from: evmAccount.address,
6183
- to: restTransaction.to,
6184
- value: (restTransaction.value || 0).toString(),
6185
- input: restTransaction.data,
6186
- timestamp: Math.floor(Date.now() / 1e3).toString(),
6177
+ try {
6178
+ const txHash = await obj.sendRawTransaction({
6179
+ serializedTransaction
6180
+ });
6181
+ addTransaction({
6182
+ chainId,
6187
6183
  hash: txHash,
6188
- source: "local"
6189
- },
6190
- address: evmAccount.address
6191
- });
6192
- modal.show((props) => {
6193
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
6194
- });
6195
- clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
6196
- delete window.matchProvider.transactionMessageIntervalMap[transactionId];
6197
- return txHash;
6184
+ info: {
6185
+ from: evmAccount.address,
6186
+ to: restTransaction.to,
6187
+ value: (restTransaction.value || 0).toString(),
6188
+ input: restTransaction.data,
6189
+ timestamp: Math.floor(Date.now() / 1e3).toString(),
6190
+ hash: txHash,
6191
+ source: "local"
6192
+ },
6193
+ address: evmAccount.address
6194
+ });
6195
+ modal.show((props) => {
6196
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, hash: txHash, chain: _chain });
6197
+ });
6198
+ return txHash;
6199
+ } catch (error) {
6200
+ modal.show((props) => {
6201
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(HashPanel_default, { isOpen: true, onClose: props.close, zIndex: props.zIndex, error: typeof error == "string" ? error : error.details || error.message, chain: _chain });
6202
+ });
6203
+ throw error;
6204
+ }
6198
6205
  } catch (error) {
6199
- console.error("qwe-sign-error", error);
6206
+ console.error("matchid-send-error", error);
6207
+ throw error;
6208
+ } finally {
6200
6209
  clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
6201
6210
  delete window.matchProvider.transactionMessageIntervalMap[transactionId];
6202
- throw error;
6203
6211
  }
6204
6212
  };
6205
6213
  const deployContract = async (parameters2) => {