@matchain/matchid-sdk-react 0.1.48-alpha.7 → 0.1.48-alpha.8

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.
Files changed (50) hide show
  1. package/dist/assets/icon/index.d.mts +1 -1
  2. package/dist/assets/icon/index.d.ts +1 -1
  3. package/dist/{chunk-2CK7JQWH.mjs → chunk-EY6NPX4M.mjs} +240 -41
  4. package/dist/chunk-EY6NPX4M.mjs.map +1 -0
  5. package/dist/{chunk-YXPWZXPT.mjs → chunk-J5U7AXYA.mjs} +2 -2
  6. package/dist/components/index.d.mts +3 -3
  7. package/dist/components/index.d.ts +3 -3
  8. package/dist/components/index.js +3 -2
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/components/index.mjs +1 -1
  11. package/dist/hooks/api/index.d.mts +2 -2
  12. package/dist/hooks/api/index.d.ts +2 -2
  13. package/dist/hooks/api/index.js +33 -2
  14. package/dist/hooks/api/index.js.map +1 -1
  15. package/dist/hooks/api/index.mjs +2 -2
  16. package/dist/hooks/index.d.mts +3 -2
  17. package/dist/hooks/index.d.ts +3 -2
  18. package/dist/hooks/index.js +299 -41
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +1 -1
  21. package/dist/{index-DCeOyAw8.d.ts → index-Bbn2Stvu.d.ts} +2 -2
  22. package/dist/index-Bz53bbI_.d.ts +3268 -0
  23. package/dist/{index-B8DYrhSW.d.mts → index-C-YCr0xJ.d.mts} +12 -4
  24. package/dist/{index-DbG5IjhP.d.mts → index-CB4j_ONH.d.mts} +1 -1
  25. package/dist/{index-B-s1k4Da.d.mts → index-CKyWWkzU.d.mts} +3 -2
  26. package/dist/{index-BZrddrq-.d.mts → index-C_S7k6z2.d.mts} +2 -2
  27. package/dist/{index-BHvCA7F9.d.ts → index-D-uNr-JV.d.ts} +2 -2
  28. package/dist/index-DDV4F9ka.d.mts +3268 -0
  29. package/dist/{index-DG_gyw1q.d.ts → index-DV_mRu4y.d.ts} +3 -2
  30. package/dist/{index-Bzcc-y8m.d.ts → index-DcxdJ0m2.d.ts} +1 -1
  31. package/dist/{index-BvLpvebq.d.mts → index-Dzvj-uGt.d.mts} +2 -2
  32. package/dist/{index-Cwx2p8th.d.ts → index-zRpvDpIK.d.ts} +12 -4
  33. package/dist/index.css +11 -0
  34. package/dist/index.d.mts +8 -7
  35. package/dist/index.d.ts +8 -7
  36. package/dist/index.js +244 -45
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +2 -2
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/dist/{types-CHkU0WHZ.d.mts → types-B4BYNw8B.d.mts} +13 -2
  42. package/dist/{types-CHkU0WHZ.d.ts → types-B4BYNw8B.d.ts} +13 -2
  43. package/dist/ui/index.d.mts +3 -3
  44. package/dist/ui/index.d.ts +3 -3
  45. package/example/src/pages/Wallet/components/MatchWallet.tsx +2 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-2CK7JQWH.mjs.map +0 -1
  48. package/dist/index-DaEFoDv_.d.ts +0 -187
  49. package/dist/index-DktvxNJc.d.mts +0 -187
  50. /package/dist/{chunk-YXPWZXPT.mjs.map → chunk-J5U7AXYA.mjs.map} +0 -0
@@ -2,11 +2,11 @@ import {
2
2
  bind_exports,
3
3
  poh_exports,
4
4
  user_exports
5
- } from "../../chunk-YXPWZXPT.mjs";
5
+ } from "../../chunk-J5U7AXYA.mjs";
6
6
  import {
7
7
  isSuccess,
8
8
  wallet_exports
9
- } from "../../chunk-2CK7JQWH.mjs";
9
+ } from "../../chunk-EY6NPX4M.mjs";
10
10
  import "../../chunk-UA6XHZHX.mjs";
11
11
  import "../../chunk-USKUYOYJ.mjs";
12
12
  import "../../chunk-7UTR37EJ.mjs";
@@ -1,8 +1,9 @@
1
- export { c as useCopyClipboard, l as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, h as useMatchWalletRecords, d as useModal, j as useReceipt, e as useToast, k as useTransaction, u as useUserInfo, b as useWallet } from '../index-DktvxNJc.mjs';
2
- import '../types-CHkU0WHZ.mjs';
1
+ export { c as useCopyClipboard, l as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, h as useMatchWalletRecords, d as useModal, j as useReceipt, e as useToast, k as useTransaction, u as useUserInfo, b as useWallet } from '../index-DDV4F9ka.mjs';
2
+ import '../types-B4BYNw8B.mjs';
3
3
  import 'react';
4
4
  import 'viem';
5
5
  import '../mpc-CTbBWHld.mjs';
6
6
  import 'viem/types/misc';
7
7
  import 'abitype';
8
+ import 'viem/_types/actions/siwe/verifySiweMessage';
8
9
  import '@tanstack/react-query';
@@ -1,8 +1,9 @@
1
- export { c as useCopyClipboard, l as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, h as useMatchWalletRecords, d as useModal, j as useReceipt, e as useToast, k as useTransaction, u as useUserInfo, b as useWallet } from '../index-DaEFoDv_.js';
2
- import '../types-CHkU0WHZ.js';
1
+ export { c as useCopyClipboard, l as useLayout, f as useMatchChain, a as useMatchEvents, g as useMatchWallet, h as useMatchWalletRecords, d as useModal, j as useReceipt, e as useToast, k as useTransaction, u as useUserInfo, b as useWallet } from '../index-Bz53bbI_.js';
2
+ import '../types-B4BYNw8B.js';
3
3
  import 'react';
4
4
  import 'viem';
5
5
  import '../mpc-CTbBWHld.js';
6
6
  import 'viem/types/misc';
7
7
  import 'abitype';
8
+ import 'viem/_types/actions/siwe/verifySiweMessage';
8
9
  import '@tanstack/react-query';
@@ -257,6 +257,13 @@ var getUserChainListApi = () => {
257
257
  method: "GET"
258
258
  });
259
259
  };
260
+ var userImportTokenApi = (data) => {
261
+ return request_default({
262
+ url: `/api/v1/user/import/token`,
263
+ method: "POST",
264
+ data
265
+ });
266
+ };
260
267
  var getUserWalletTransactionsApi = (data) => {
261
268
  return request_default({
262
269
  url: `/api/v1/user/wallet/transactions`,
@@ -395,12 +402,43 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
395
402
 
396
403
  // src/assets/icon/CloseEyeIcon.tsx
397
404
  var import_jsx_runtime16 = require("react/jsx-runtime");
405
+ function CloseEyeIcon({
406
+ size = 20,
407
+ color = "#6E6E6E"
408
+ }) {
409
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
410
+ "path",
411
+ {
412
+ d: "M9.15132 12.5568V11.5464C8.21031 11.4949 7.28023 11.3193 6.38524 11.024L6.04233 11.9579C6.00626 12.0669 5.94867 12.1676 5.87299 12.2539C5.79731 12.3403 5.70508 12.4106 5.60174 12.4607C5.4984 12.5108 5.38607 12.5396 5.27139 12.5455C5.15671 12.5514 5.04201 12.5342 4.93409 12.4949C4.82617 12.4557 4.72722 12.3952 4.6431 12.317C4.55898 12.2389 4.49139 12.1446 4.44435 12.0399C4.3973 11.9351 4.37175 11.822 4.36921 11.7072C4.36667 11.5924 4.38719 11.4783 4.42955 11.3715L4.80788 10.3268C4.04603 9.88461 3.32634 9.37345 2.65789 8.79975C2.54358 8.70488 2.42928 8.61687 2.32184 8.52772C2.1442 8.38554 2.03031 8.17862 2.00523 7.95247C1.98015 7.72633 2.04593 7.49948 2.18811 7.32184C2.33028 7.1442 2.5372 7.03031 2.76335 7.00523C2.98949 6.98015 3.21634 7.04593 3.39398 7.18811C3.50828 7.27955 3.62258 7.37099 3.73689 7.47043C5.46065 9.00826 7.68996 9.85815 10 9.85815C12.31 9.85815 14.5393 9.00826 16.2631 7.47043C16.3774 7.37099 16.4917 7.27955 16.606 7.18811C16.694 7.11771 16.7949 7.06533 16.9031 7.03395C17.0114 7.00257 17.1247 6.99281 17.2367 7.00523C17.3486 7.01765 17.4571 7.052 17.5558 7.10632C17.6545 7.16065 17.7415 7.23388 17.8119 7.32184C17.8823 7.4098 17.9347 7.51077 17.9661 7.61897C17.9974 7.72717 18.0072 7.8405 17.9948 7.95247C17.9824 8.06445 17.948 8.17288 17.8937 8.27158C17.8394 8.37028 17.7661 8.45732 17.6782 8.52772L17.3421 8.79975C16.6737 9.37354 15.954 9.88471 15.1921 10.3268L15.5705 11.3715C15.6128 11.4783 15.6333 11.5924 15.6308 11.7072C15.6283 11.822 15.6027 11.9351 15.5557 12.0399C15.5086 12.1446 15.441 12.2389 15.3569 12.317C15.2728 12.3952 15.1738 12.4557 15.0659 12.4949C14.958 12.5342 14.8433 12.5514 14.7286 12.5455C14.6139 12.5396 14.5016 12.5108 14.3983 12.4607C14.2949 12.4106 14.2027 12.3403 14.127 12.2539C14.0513 12.1676 13.9937 12.0669 13.9577 11.9579L13.6148 11.024C12.7198 11.3193 11.7897 11.4949 10.8487 11.5464V12.5568C10.8487 12.7842 10.7584 13.0022 10.5976 13.163C10.4368 13.3238 10.2188 13.4141 9.99143 13.4141C9.76407 13.4141 9.54602 13.3238 9.38526 13.163C9.22449 13.0022 9.13417 12.7842 9.13417 12.5568H9.15132Z",
413
+ fill: color
414
+ }
415
+ ) });
416
+ }
398
417
 
399
418
  // src/assets/icon/OpenEyeIcon.tsx
400
419
  var import_jsx_runtime17 = require("react/jsx-runtime");
420
+ function OpenEyeIcon({
421
+ size = 20,
422
+ color = "#6E6E6E"
423
+ }) {
424
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
425
+ "path",
426
+ {
427
+ d: "M10 6.4543C11.3373 6.44986 12.6486 6.82287 13.7834 7.53047C14.9181 8.23806 15.8301 9.25151 16.4145 10.4543C15.2145 12.9052 12.7564 14.4543 10 14.4543C7.24364 14.4543 4.78545 12.9052 3.58545 10.4543C4.1699 9.25151 5.08191 8.23806 6.21664 7.53047C7.35136 6.82287 8.66274 6.44986 10 6.4543ZM10 4.99976C6.36364 4.99976 3.25818 7.26157 2 10.4543C3.25818 13.647 6.36364 15.9088 10 15.9088C13.6364 15.9088 16.7418 13.647 18 10.4543C16.7418 7.26157 13.6364 4.99976 10 4.99976ZM10 8.63612C10.4822 8.63617 10.9446 8.82774 11.2855 9.16871C11.6265 9.50968 11.818 9.97212 11.818 10.4543C11.818 10.9365 11.6265 11.3989 11.2855 11.7399C10.9446 12.0809 10.4822 12.2724 10 12.2725C9.51782 12.2724 9.0554 12.0809 8.71447 11.7399C8.37353 11.3989 8.18199 10.9365 8.18199 10.4543C8.18199 9.97212 8.37353 9.50968 8.71447 9.16871C9.0554 8.82774 9.51782 8.63617 10 8.63612ZM10 7.18157C8.19636 7.18157 6.72727 8.65066 6.72727 10.4543C6.72727 12.2579 8.19636 13.727 10 13.727C11.8036 13.727 13.2727 12.2579 13.2727 10.4543C13.2727 8.65066 11.8036 7.18157 10 7.18157Z",
428
+ fill: color
429
+ }
430
+ ) });
431
+ }
401
432
 
402
433
  // src/assets/icon/DeleteRoundIcon.tsx
403
434
  var import_jsx_runtime18 = require("react/jsx-runtime");
435
+ function DeleteRoundIcon({ height = 21, width = 20, color = "var(--matchid-error-color)", ...props }) {
436
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width, height, viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
437
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { y: "0.5", width: "20", height: "20", rx: "10", fill: color }),
438
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M7.17139 7.67188L12.8282 13.3287", stroke: "white", strokeLinecap: "round" }),
439
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12.8286 7.67188L7.17176 13.3287", stroke: "white", strokeLinecap: "round" })
440
+ ] });
441
+ }
404
442
 
405
443
  // src/assets/icon/FacebookIcon.tsx
406
444
  var import_jsx_runtime19 = require("react/jsx-runtime");
@@ -622,9 +660,60 @@ function Button({
622
660
  // src/ui/Input/index.tsx
623
661
  var import_react3 = require("react");
624
662
  var import_jsx_runtime51 = require("react/jsx-runtime");
663
+ function Input({
664
+ onChange,
665
+ type,
666
+ after,
667
+ className = "",
668
+ ...props
669
+ }) {
670
+ const [inputType, setInputType] = (0, import_react3.useState)(type);
671
+ const isDownMd = useDownMd();
672
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
673
+ "div",
674
+ {
675
+ className: `matchid-input-box ${props.value && props.value.length > 0 ? "matchid-input-has-content" : ""} ${className}`,
676
+ children: [
677
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("input", { type: inputType, onChange, ...props, className: "matchid-input-field" }),
678
+ props.value && props.value.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "matchid-input-delete-icon", onClick: (e) => {
679
+ if (onChange) {
680
+ onChange({ target: { value: "" } });
681
+ }
682
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
683
+ DeleteRoundIcon,
684
+ {
685
+ height: isDownMd ? 16 : 21,
686
+ width: isDownMd ? 16 : 20,
687
+ color: "var(--matchid-input-delete-icon-color)"
688
+ }
689
+ ) }),
690
+ type === "password" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "matchid-input-eye-icon", onClick: () => {
691
+ setInputType(inputType === "password" ? "text" : "password");
692
+ }, children: inputType === "password" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CloseEyeIcon, { size: isDownMd ? 16 : 20 }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(OpenEyeIcon, { size: isDownMd ? 16 : 20 }) }),
693
+ after
694
+ ]
695
+ }
696
+ );
697
+ }
625
698
 
626
699
  // src/ui/Field/index.tsx
627
700
  var import_jsx_runtime52 = require("react/jsx-runtime");
701
+ function Field({
702
+ label,
703
+ children,
704
+ error,
705
+ required,
706
+ className = ""
707
+ }) {
708
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `matchid-field-box ${className}`, children: [
709
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "matchid-field-label", children: [
710
+ required && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "matchid-field-required", children: "*" }),
711
+ label
712
+ ] }),
713
+ children,
714
+ error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "matchid-field-error", children: error })
715
+ ] });
716
+ }
628
717
 
629
718
  // src/components/EmailModal/StepEmail.tsx
630
719
  var import_react_intl = require("react-intl");
@@ -1452,6 +1541,7 @@ function useChainListQuery(options) {
1452
1541
 
1453
1542
  // src/hooks/useMatchChain.tsx
1454
1543
  var import_react32 = require("react");
1544
+ var import_viem5 = require("viem");
1455
1545
  var import_jsx_runtime82 = require("react/jsx-runtime");
1456
1546
  function useMatchChain() {
1457
1547
  const chainListQuery = useChainListQuery();
@@ -1511,13 +1601,23 @@ function useMatchChain() {
1511
1601
  content: ChangeNetwork
1512
1602
  });
1513
1603
  };
1604
+ const publicClient = (0, import_react32.useMemo)(() => {
1605
+ if (!chain) {
1606
+ return null;
1607
+ }
1608
+ return (0, import_viem5.createPublicClient)({
1609
+ chain,
1610
+ transport: (0, import_viem5.http)()
1611
+ });
1612
+ }, [chain]);
1514
1613
  return {
1515
1614
  list: chainListQuery.data,
1516
1615
  chainId,
1517
1616
  setChainId,
1518
1617
  chain,
1519
1618
  explorerLink,
1520
- showChangeNetwork
1619
+ showChangeNetwork,
1620
+ publicClient
1521
1621
  };
1522
1622
  }
1523
1623
 
@@ -1530,50 +1630,210 @@ var address = "0x4143e29770fd63e24bb1f32d50bf8a590e34de4b";
1530
1630
 
1531
1631
  // src/hooks/useMatchWallet.tsx
1532
1632
  var import_jsx_runtime83 = require("react/jsx-runtime");
1533
- function useMatchWallet() {
1534
- const modal = useModal();
1535
- const { address: address2 } = useWallet2();
1633
+ var ReceiveModal = () => {
1536
1634
  const chain = useMatchChain();
1635
+ const { address: address2 } = useWallet2();
1537
1636
  const [copied, setCopied] = useCopyClipboard();
1538
1637
  const toast = useToast();
1539
1638
  const onCopy = () => {
1540
1639
  setCopied(address2);
1541
1640
  toast.success("Copied!");
1542
1641
  };
1642
+ const chainLink = chain.explorerLink("address/" + address2);
1643
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-receive-modal`, children: [
1644
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "matchid-receive-container", children: [
1645
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
1646
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1647
+ import_react_qrcode.QRCode,
1648
+ {
1649
+ margin: "0",
1650
+ className: `matchid-qr-code`,
1651
+ value: address2
1652
+ }
1653
+ ) }),
1654
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1655
+ "a",
1656
+ {
1657
+ href: chainLink,
1658
+ target: "_blank",
1659
+ className: `matchid-receive-link`,
1660
+ children: address2
1661
+ }
1662
+ )
1663
+ ] }),
1664
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
1665
+ ] });
1666
+ };
1667
+ var ImportTokenModal = ({ close }) => {
1668
+ const [address2, setAddress] = (0, import_react33.useState)("");
1669
+ const [symbol, setSymbol] = (0, import_react33.useState)("");
1670
+ const [decimals, setDecimals] = (0, import_react33.useState)("");
1671
+ const [error, setError] = (0, import_react33.useState)({});
1672
+ const { publicClient, chainId } = useMatchChain();
1673
+ const getContractInfo = async () => {
1674
+ if (!publicClient) return;
1675
+ const erc20Abi = [
1676
+ {
1677
+ name: "decimals",
1678
+ type: "function",
1679
+ stateMutability: "view",
1680
+ inputs: [],
1681
+ outputs: [{ name: "decimals", type: "uint8" }]
1682
+ },
1683
+ {
1684
+ name: "symbol",
1685
+ type: "function",
1686
+ stateMutability: "view",
1687
+ inputs: [],
1688
+ outputs: [{ name: "symbol", type: "string" }]
1689
+ }
1690
+ ];
1691
+ const calls = [
1692
+ {
1693
+ address: address2,
1694
+ abi: erc20Abi,
1695
+ functionName: "symbol",
1696
+ args: []
1697
+ },
1698
+ {
1699
+ address: address2,
1700
+ abi: erc20Abi,
1701
+ functionName: "decimals",
1702
+ args: []
1703
+ }
1704
+ ];
1705
+ try {
1706
+ const results = await publicClient.multicall({ contracts: calls });
1707
+ console.log("results", results);
1708
+ if (!symbol && results[0]?.status == "success") {
1709
+ setSymbol(results[0]?.result);
1710
+ }
1711
+ if (!decimals && results[1]?.status == "success") {
1712
+ setDecimals((results[1]?.result).toString());
1713
+ }
1714
+ } catch (error2) {
1715
+ setError({
1716
+ address: error2.message
1717
+ });
1718
+ }
1719
+ };
1720
+ (0, import_react33.useEffect)(() => {
1721
+ if (address2.length === 42) {
1722
+ const reg = /^0x[0-9a-fA-F]{40}$/;
1723
+ if (!reg.test(address2)) {
1724
+ setError({
1725
+ ...error,
1726
+ address: "Invalid address"
1727
+ });
1728
+ } else {
1729
+ setError({
1730
+ ...error,
1731
+ address: ""
1732
+ });
1733
+ publicClient && getContractInfo();
1734
+ }
1735
+ }
1736
+ }, [address2, publicClient]);
1737
+ const [loading, setLoading] = (0, import_react33.useState)(false);
1738
+ const toast = useToast();
1739
+ const onImport = async () => {
1740
+ setLoading(true);
1741
+ try {
1742
+ const res = await userImportTokenApi({
1743
+ chain_id: chainId?.toString() || "",
1744
+ symbol,
1745
+ address: address2,
1746
+ decimals
1747
+ });
1748
+ if (isSuccess(res)) {
1749
+ toast.success("Imported successfully");
1750
+ close();
1751
+ } else {
1752
+ toast.error(res.message);
1753
+ }
1754
+ } catch (error2) {
1755
+ toast.error(error2.message);
1756
+ } finally {
1757
+ setLoading(false);
1758
+ }
1759
+ };
1760
+ const canImport = (0, import_react33.useMemo)(() => {
1761
+ if (!address2) {
1762
+ return false;
1763
+ }
1764
+ if (!symbol) {
1765
+ return false;
1766
+ }
1767
+ if (decimals.length === 0) {
1768
+ return false;
1769
+ }
1770
+ const reg = /^0x[0-9a-fA-F]{40}$/;
1771
+ if (!reg.test(address2)) {
1772
+ return false;
1773
+ }
1774
+ return true;
1775
+ }, [error, address2, symbol, decimals]);
1776
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-import-token`, children: [
1777
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "matchid-import-token-form", children: [
1778
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Field, { label: "Token Smart Contract", error: error.address, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1779
+ Input,
1780
+ {
1781
+ placeholder: "Enter the Token Smart Contract",
1782
+ value: address2,
1783
+ onChange: (e) => setAddress(e.target.value),
1784
+ maxLength: 42
1785
+ }
1786
+ ) }),
1787
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Field, { label: "Token Symbol", error: error.symbol, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1788
+ Input,
1789
+ {
1790
+ placeholder: "Enter the Token Symbol",
1791
+ value: symbol,
1792
+ onChange: (e) => setSymbol(e.target.value),
1793
+ maxLength: 16
1794
+ }
1795
+ ) }),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Field, { label: "Decimals", error: error.decimals, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1797
+ Input,
1798
+ {
1799
+ placeholder: "Enter the Decimals",
1800
+ type: "number",
1801
+ value: decimals,
1802
+ onChange: (e) => setDecimals(e.target.value)
1803
+ }
1804
+ ) })
1805
+ ] }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1807
+ Button,
1808
+ {
1809
+ size: "lg",
1810
+ onClick: onImport,
1811
+ block: true,
1812
+ loading,
1813
+ disabled: !canImport,
1814
+ highlight: true,
1815
+ children: "Import"
1816
+ }
1817
+ )
1818
+ ] });
1819
+ };
1820
+ function useMatchWallet() {
1821
+ const modal = useModal();
1543
1822
  const showReceiveModal = () => {
1544
- const chainLink = chain.explorerLink("address/" + address2);
1545
- const ReceiveModal = () => {
1546
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `matchid-receive-modal`, children: [
1547
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "matchid-receive-container", children: [
1548
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-receive-text`, children: "Receive by scanning the QR code" }),
1549
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: `matchid-qr-container`, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1550
- import_react_qrcode.QRCode,
1551
- {
1552
- margin: "0",
1553
- className: `matchid-qr-code`,
1554
- value: address2
1555
- }
1556
- ) }),
1557
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
1558
- "a",
1559
- {
1560
- href: chainLink,
1561
- target: "_blank",
1562
- className: `matchid-receive-link`,
1563
- children: address2
1564
- }
1565
- )
1566
- ] }),
1567
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Button, { size: "lg", onClick: onCopy, block: true, highlight: true, disabled: copied, children: "Copy Address" })
1568
- ] });
1569
- };
1570
1823
  modal.open({
1571
1824
  title: "Receive",
1572
1825
  content: ReceiveModal
1573
1826
  });
1574
1827
  };
1828
+ const showImportTokenModal = () => {
1829
+ modal.open({
1830
+ title: "Customized Token",
1831
+ content: ImportTokenModal
1832
+ });
1833
+ };
1575
1834
  return {
1576
- showReceiveModal
1835
+ showReceiveModal,
1836
+ showImportTokenModal
1577
1837
  };
1578
1838
  }
1579
1839
  function useMatchWalletRecords({
@@ -1622,7 +1882,7 @@ function useMatchWalletRecords({
1622
1882
  // src/hooks/useReceipt.tsx
1623
1883
  var import_react34 = require("react");
1624
1884
  var import_react_query5 = require("@tanstack/react-query");
1625
- var import_viem5 = require("viem");
1885
+ var import_viem6 = require("viem");
1626
1886
  var CACHE_TTL = 86400 * 30 * 1e3;
1627
1887
  var MAX_CACHE_SIZE = 500;
1628
1888
  var STORAGE_KEY = "match_receipt_logs";
@@ -1739,10 +1999,9 @@ function useReceipt({
1739
1999
  return cache.get(cacheKey);
1740
2000
  }
1741
2001
  try {
1742
- const publicClient = (0, import_viem5.createPublicClient)({
1743
- //@ts-ignore
1744
- chain: (0, import_viem5.defineChain)(chain),
1745
- transport: (0, import_viem5.http)()
2002
+ const publicClient = (0, import_viem6.createPublicClient)({
2003
+ chain: (0, import_viem6.defineChain)(chain),
2004
+ transport: (0, import_viem6.http)()
1746
2005
  });
1747
2006
  const receipt = await publicClient.getTransactionReceipt({ hash });
1748
2007
  if (!receipt) {
@@ -1767,7 +2026,7 @@ function useReceipt({
1767
2026
  // src/hooks/useTransaction.tsx
1768
2027
  var import_react35 = require("react");
1769
2028
  var import_react_query6 = require("@tanstack/react-query");
1770
- var import_viem6 = require("viem");
2029
+ var import_viem7 = require("viem");
1771
2030
  var CACHE_TTL2 = 86400 * 30 * 1e3;
1772
2031
  var MAX_CACHE_SIZE2 = 500;
1773
2032
  var STORAGE_KEY2 = "match_transaction_logs";
@@ -1884,10 +2143,9 @@ function useTransaction({
1884
2143
  return cache.get(cacheKey);
1885
2144
  }
1886
2145
  try {
1887
- const publicClient = (0, import_viem6.createPublicClient)({
1888
- //@ts-ignore
1889
- chain: (0, import_viem6.defineChain)(chain),
1890
- transport: (0, import_viem6.http)()
2146
+ const publicClient = (0, import_viem7.createPublicClient)({
2147
+ chain: (0, import_viem7.defineChain)(chain),
2148
+ transport: (0, import_viem7.http)()
1891
2149
  });
1892
2150
  const transaction = await publicClient.getTransaction({ hash });
1893
2151
  if (!transaction) {