@matchain/matchid-sdk-react 0.1.54 → 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.
- package/dist/assets/icon/index.d.mts +2 -2
- package/dist/assets/icon/index.d.ts +2 -2
- package/dist/chunk-LTPXS5PV.mjs +97 -0
- package/dist/chunk-LTPXS5PV.mjs.map +1 -0
- package/dist/{chunk-ZPBHHXEE.mjs → chunk-SKA35IYC.mjs} +6547 -6893
- package/dist/chunk-SKA35IYC.mjs.map +1 -0
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +35 -381
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -6
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +45 -215
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +6 -6
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +220 -229
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-91BdMYDA.d.ts → index-6-oVBXRP.d.mts} +2 -5
- package/dist/{index-D5geEbXf.d.ts → index-6kXyNEXB.d.ts} +3 -2
- package/dist/{index-DSvRdAyZ.d.mts → index-CB6ZNvzn.d.mts} +3 -2
- package/dist/{index-CkHDxE7B.d.mts → index-CBQXIlWu.d.mts} +1 -1
- package/dist/{index-ChHJD4NZ.d.mts → index-CMH6Jesl.d.ts} +2 -5
- package/dist/{index-Dj1K-UdZ.d.ts → index-CNH7a3bx.d.ts} +5 -18
- package/dist/{index-CZu_8fKl.d.ts → index-CPPDmmz8.d.ts} +1 -1
- package/dist/{index-DX1vzCrM.d.mts → index-CqKohtvj.d.mts} +1 -1
- package/dist/{index-CPk553v5.d.mts → index-D0Psl8Ue.d.mts} +1 -1
- package/dist/{index-DFBrN7dx.d.ts → index-DbQn4z1l.d.ts} +1 -1
- package/dist/{index-DjwwXNp4.d.mts → index-G15A08DI.d.mts} +3 -40
- package/dist/{index-Vxvd14yW.d.ts → index-Y5WRoqzn.d.ts} +3 -40
- package/dist/{index-CPwcm70o.d.mts → index-a_Qt7NXk.d.mts} +5 -18
- package/dist/{index-SRHVQn5G.d.ts → index-agAVLGF5.d.ts} +1 -1
- package/dist/index.css +1 -121
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +603 -878
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Bi9iq57H.d.mts → types-CXzZS0eM.d.mts} +1 -20
- package/dist/{types-Bi9iq57H.d.ts → types-CXzZS0eM.d.ts} +1 -20
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.js +57 -72
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +2 -2
- package/example/src/App.tsx +0 -8
- package/example/src/pages/Wallet/index.tsx +4 -1
- package/package.json +1 -1
- package/dist/chunk-ZPBHHXEE.mjs.map +0 -1
- package/example/src/pages/Contact/index.tsx +0 -90
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BTCModal,
|
|
2
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
1
|
+
export { B as BTCModal, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-a_Qt7NXk.mjs';
|
|
2
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-CBQXIlWu.mjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-CXzZS0eM.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BTCModal,
|
|
2
|
-
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-
|
|
1
|
+
export { B as BTCModal, d as EVMModal, E as EmailModal, L as LoginBox, a as LoginButton, c as LoginModal, b as LoginPanel, e as TONModal, T as TRONModal, g as TokenDetail, h as TokenSend, j as TokenSendList, k as TransactionList, U as UsernameModal, f as WalletAsset, W as WalletModal } from '../index-CNH7a3bx.js';
|
|
2
|
+
export { B as Button, F as Field, I as Input, M as Modal, a as ModalWithHeader, O as Overlay, P as Popover } from '../index-agAVLGF5.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-CXzZS0eM.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import '@tanstack/react-query/src/types';
|
package/dist/components/index.js
CHANGED
|
@@ -32,8 +32,6 @@ var components_exports = {};
|
|
|
32
32
|
__export(components_exports, {
|
|
33
33
|
BTCModal: () => BTCModal,
|
|
34
34
|
Button: () => Button,
|
|
35
|
-
ContactCard: () => ContactCard,
|
|
36
|
-
ContactList: () => ContactList,
|
|
37
35
|
EVMModal: () => EVMModal,
|
|
38
36
|
EmailModal: () => EmailModal,
|
|
39
37
|
Field: () => Field,
|
|
@@ -1208,36 +1206,6 @@ function PhantomIcon({
|
|
|
1208
1206
|
|
|
1209
1207
|
// src/assets/icon/MoreIcon.tsx
|
|
1210
1208
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
1211
|
-
function MoreIcon({
|
|
1212
|
-
width = "11",
|
|
1213
|
-
height = "3",
|
|
1214
|
-
color = "black",
|
|
1215
|
-
...props
|
|
1216
|
-
}) {
|
|
1217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width, height, viewBox: "0 0 11 3", fill: "none", ...props, children: [
|
|
1218
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
1219
|
-
"path",
|
|
1220
|
-
{
|
|
1221
|
-
d: "M2.3335 1.33325C2.3335 1.88554 1.88578 2.33325 1.3335 2.33325C0.781211 2.33325 0.333496 1.88554 0.333496 1.33325C0.333496 0.780967 0.781211 0.333252 1.3335 0.333252C1.88578 0.333252 2.3335 0.780967 2.3335 1.33325Z",
|
|
1222
|
-
fill: color
|
|
1223
|
-
}
|
|
1224
|
-
),
|
|
1225
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
1226
|
-
"path",
|
|
1227
|
-
{
|
|
1228
|
-
d: "M6.3335 1.33325C6.3335 1.88554 5.88578 2.33325 5.3335 2.33325C4.78121 2.33325 4.3335 1.88554 4.3335 1.33325C4.3335 0.780967 4.78121 0.333252 5.3335 0.333252C5.88578 0.333252 6.3335 0.780967 6.3335 1.33325Z",
|
|
1229
|
-
fill: color
|
|
1230
|
-
}
|
|
1231
|
-
),
|
|
1232
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
1233
|
-
"path",
|
|
1234
|
-
{
|
|
1235
|
-
d: "M10.3335 1.33325C10.3335 1.88554 9.88578 2.33325 9.3335 2.33325C8.78121 2.33325 8.3335 1.88554 8.3335 1.33325C8.3335 0.780967 8.78121 0.333252 9.3335 0.333252C9.88578 0.333252 10.3335 0.780967 10.3335 1.33325Z",
|
|
1236
|
-
fill: color
|
|
1237
|
-
}
|
|
1238
|
-
)
|
|
1239
|
-
] });
|
|
1240
|
-
}
|
|
1241
1209
|
|
|
1242
1210
|
// src/hooks/useLayout.tsx
|
|
1243
1211
|
var import_react = require("react");
|
|
@@ -1864,47 +1832,6 @@ var tgAppLoginInitApi = () => {
|
|
|
1864
1832
|
method: "GET"
|
|
1865
1833
|
});
|
|
1866
1834
|
};
|
|
1867
|
-
var getContactListApi = (data) => {
|
|
1868
|
-
return request_default({
|
|
1869
|
-
url: `/api/v1/contacts/list`,
|
|
1870
|
-
method: "POST",
|
|
1871
|
-
data
|
|
1872
|
-
});
|
|
1873
|
-
};
|
|
1874
|
-
var searchContactsApi = (data) => {
|
|
1875
|
-
return request_default({
|
|
1876
|
-
url: `/api/v1/contacts/search`,
|
|
1877
|
-
method: "POST",
|
|
1878
|
-
data
|
|
1879
|
-
});
|
|
1880
|
-
};
|
|
1881
|
-
var addContactsApi = (data) => {
|
|
1882
|
-
return request_default({
|
|
1883
|
-
url: `/api/v1/contacts/add`,
|
|
1884
|
-
method: "POST",
|
|
1885
|
-
data
|
|
1886
|
-
});
|
|
1887
|
-
};
|
|
1888
|
-
var acceptContactsApi = (data) => {
|
|
1889
|
-
return request_default({
|
|
1890
|
-
url: `/api/v1/contacts/accept`,
|
|
1891
|
-
method: "POST",
|
|
1892
|
-
data
|
|
1893
|
-
});
|
|
1894
|
-
};
|
|
1895
|
-
var delContactsApi = (data) => {
|
|
1896
|
-
return request_default({
|
|
1897
|
-
url: `/api/v1/contacts/del`,
|
|
1898
|
-
method: "POST",
|
|
1899
|
-
data
|
|
1900
|
-
});
|
|
1901
|
-
};
|
|
1902
|
-
var getContractsInfoApi = () => {
|
|
1903
|
-
return retryRequest({
|
|
1904
|
-
url: `/api/v1/contacts/info`,
|
|
1905
|
-
method: "GET"
|
|
1906
|
-
});
|
|
1907
|
-
};
|
|
1908
1835
|
var userInviteApi = (data) => {
|
|
1909
1836
|
return request_default({
|
|
1910
1837
|
url: `/api/v1/user/invite`,
|
|
@@ -2131,7 +2058,8 @@ function HashPanel({
|
|
|
2131
2058
|
chain,
|
|
2132
2059
|
isOpen,
|
|
2133
2060
|
onClose,
|
|
2134
|
-
zIndex
|
|
2061
|
+
zIndex,
|
|
2062
|
+
error
|
|
2135
2063
|
}) {
|
|
2136
2064
|
const [status, setStatus] = (0, import_react7.useState)("confirm");
|
|
2137
2065
|
const statusMaps = {
|
|
@@ -2156,7 +2084,7 @@ function HashPanel({
|
|
|
2156
2084
|
color: "#F14141"
|
|
2157
2085
|
}
|
|
2158
2086
|
};
|
|
2159
|
-
const statusValue = statusMaps[status];
|
|
2087
|
+
const statusValue = error ? statusMaps.fail : statusMaps[status];
|
|
2160
2088
|
const [shouldRefetch, setShouldRefetch] = (0, import_react7.useState)(true);
|
|
2161
2089
|
(0, import_react7.useEffect)(() => {
|
|
2162
2090
|
if (hash) {
|
|
@@ -2210,7 +2138,8 @@ function HashPanel({
|
|
|
2210
2138
|
hash && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "matchid-hashpanel-hash", children: [
|
|
2211
2139
|
"Hash:",
|
|
2212
2140
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("a", { href: link, target: "_blank", children: hash })
|
|
2213
|
-
] })
|
|
2141
|
+
] }),
|
|
2142
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "matchid-hashpanel-text", children: error })
|
|
2214
2143
|
] }),
|
|
2215
2144
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Button, { onClick: onClose, size: "lg", block: true, children: "Back" })
|
|
2216
2145
|
] })
|
|
@@ -2306,33 +2235,6 @@ function Radio({
|
|
|
2306
2235
|
|
|
2307
2236
|
// src/ui/Skeleton/index.tsx
|
|
2308
2237
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
2309
|
-
var Skeleton = ({
|
|
2310
|
-
style = {},
|
|
2311
|
-
className = "",
|
|
2312
|
-
width = 40,
|
|
2313
|
-
height = 40,
|
|
2314
|
-
radius = 5,
|
|
2315
|
-
loading = true,
|
|
2316
|
-
children
|
|
2317
|
-
}) => {
|
|
2318
|
-
if (!loading) {
|
|
2319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children });
|
|
2320
|
-
}
|
|
2321
|
-
const skeletonStyle = {
|
|
2322
|
-
width,
|
|
2323
|
-
height,
|
|
2324
|
-
borderRadius: radius,
|
|
2325
|
-
...style
|
|
2326
|
-
};
|
|
2327
|
-
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
2328
|
-
"div",
|
|
2329
|
-
{
|
|
2330
|
-
className: "matchid-skeleton " + className,
|
|
2331
|
-
style: skeletonStyle
|
|
2332
|
-
}
|
|
2333
|
-
);
|
|
2334
|
-
};
|
|
2335
|
-
var Skeleton_default = Skeleton;
|
|
2336
2238
|
|
|
2337
2239
|
// src/ui/Tabs/index.tsx
|
|
2338
2240
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
@@ -2534,34 +2436,40 @@ function useWallet() {
|
|
|
2534
2436
|
prepareTransactionRequest
|
|
2535
2437
|
}
|
|
2536
2438
|
});
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
info: {
|
|
2544
|
-
from: evmAccount.address,
|
|
2545
|
-
to: restTransaction.to,
|
|
2546
|
-
value: (restTransaction.value || 0).toString(),
|
|
2547
|
-
input: restTransaction.data,
|
|
2548
|
-
timestamp: Math.floor(Date.now() / 1e3).toString(),
|
|
2439
|
+
try {
|
|
2440
|
+
const txHash = await obj.sendRawTransaction({
|
|
2441
|
+
serializedTransaction
|
|
2442
|
+
});
|
|
2443
|
+
addTransaction({
|
|
2444
|
+
chainId,
|
|
2549
2445
|
hash: txHash,
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
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
|
+
}
|
|
2560
2467
|
} catch (error) {
|
|
2561
|
-
console.error("
|
|
2468
|
+
console.error("matchid-send-error", error);
|
|
2469
|
+
throw error;
|
|
2470
|
+
} finally {
|
|
2562
2471
|
clearInterval(window.matchProvider.transactionMessageIntervalMap[transactionId].interval);
|
|
2563
2472
|
delete window.matchProvider.transactionMessageIntervalMap[transactionId];
|
|
2564
|
-
throw error;
|
|
2565
2473
|
}
|
|
2566
2474
|
};
|
|
2567
2475
|
const deployContract = async (parameters2) => {
|
|
@@ -2631,13 +2539,6 @@ var import_react13 = require("react");
|
|
|
2631
2539
|
var import_react_dom2 = require("react-dom");
|
|
2632
2540
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
2633
2541
|
var ToastContext = (0, import_react13.createContext)(null);
|
|
2634
|
-
function useToast() {
|
|
2635
|
-
const context = (0, import_react13.useContext)(ToastContext);
|
|
2636
|
-
if (!context) {
|
|
2637
|
-
throw new Error("useToast must be used within a ToastProvider");
|
|
2638
|
-
}
|
|
2639
|
-
return context;
|
|
2640
|
-
}
|
|
2641
2542
|
|
|
2642
2543
|
// src/hooks/api/wallet.ts
|
|
2643
2544
|
var import_react_query2 = require("@tanstack/react-query");
|
|
@@ -6468,257 +6369,10 @@ function TransactionList({
|
|
|
6468
6369
|
}
|
|
6469
6370
|
);
|
|
6470
6371
|
}
|
|
6471
|
-
|
|
6472
|
-
// src/hooks/api/bind.ts
|
|
6473
|
-
var import_react_query11 = require("@tanstack/react-query");
|
|
6474
|
-
|
|
6475
|
-
// src/hooks/api/poh.ts
|
|
6476
|
-
var import_react_query12 = require("@tanstack/react-query");
|
|
6477
|
-
|
|
6478
|
-
// src/hooks/api/contact.ts
|
|
6479
|
-
var contact_exports = {};
|
|
6480
|
-
__export(contact_exports, {
|
|
6481
|
-
acceptContact: () => acceptContact,
|
|
6482
|
-
addContact: () => addContact,
|
|
6483
|
-
delContact: () => delContact,
|
|
6484
|
-
useContactInfo: () => useContactInfo,
|
|
6485
|
-
useContactList: () => useContactList,
|
|
6486
|
-
useContactSearch: () => useContactSearch
|
|
6487
|
-
});
|
|
6488
|
-
var import_react_query13 = require("@tanstack/react-query");
|
|
6489
|
-
var import_last = __toESM(require("lodash/last"));
|
|
6490
|
-
var import_react43 = require("react");
|
|
6491
|
-
function useContactList(page_size = 10, type = "Friend") {
|
|
6492
|
-
const { address } = useUserInfo();
|
|
6493
|
-
const limitIdRef = (0, import_react43.useRef)(0);
|
|
6494
|
-
const contactQuery = (0, import_react_query13.useInfiniteQuery)({
|
|
6495
|
-
queryKey: ["matchid-contacts-list", type, address],
|
|
6496
|
-
initialPageParam: 1,
|
|
6497
|
-
queryFn: async (args) => {
|
|
6498
|
-
console.log(args);
|
|
6499
|
-
if (args.pageParam <= 1) {
|
|
6500
|
-
limitIdRef.current = 0;
|
|
6501
|
-
}
|
|
6502
|
-
return (await getContactListApi({
|
|
6503
|
-
limit: page_size,
|
|
6504
|
-
limit_id: limitIdRef.current,
|
|
6505
|
-
type
|
|
6506
|
-
})).data;
|
|
6507
|
-
},
|
|
6508
|
-
getNextPageParam: (lastPage, allPages) => {
|
|
6509
|
-
if (!lastPage) return void 0;
|
|
6510
|
-
const lastPageNum = Math.ceil(lastPage.meta.total / page_size);
|
|
6511
|
-
return allPages.length >= lastPageNum ? void 0 : allPages.length + 1;
|
|
6512
|
-
}
|
|
6513
|
-
});
|
|
6514
|
-
(0, import_react43.useEffect)(() => {
|
|
6515
|
-
if (!contactQuery.data?.pages || contactQuery.data?.pages.length == 0) {
|
|
6516
|
-
limitIdRef.current = 0;
|
|
6517
|
-
} else {
|
|
6518
|
-
const lastPage = (0, import_last.default)(contactQuery.data?.pages);
|
|
6519
|
-
const items = lastPage?.items;
|
|
6520
|
-
if (!items || items.length == 0) {
|
|
6521
|
-
limitIdRef.current = 0;
|
|
6522
|
-
return;
|
|
6523
|
-
}
|
|
6524
|
-
const lastItem = (0, import_last.default)(items);
|
|
6525
|
-
limitIdRef.current = lastItem?.limit_id || 0;
|
|
6526
|
-
}
|
|
6527
|
-
}, [contactQuery.data?.pages]);
|
|
6528
|
-
(0, import_react43.useEffect)(() => {
|
|
6529
|
-
console.log("contactQuery.data", contactQuery.data);
|
|
6530
|
-
}, [contactQuery.data]);
|
|
6531
|
-
const data = (0, import_react43.useMemo)(() => {
|
|
6532
|
-
return (contactQuery.data?.pages ?? []).reduce(
|
|
6533
|
-
(a, b) => {
|
|
6534
|
-
return a.concat(b?.items ?? []);
|
|
6535
|
-
},
|
|
6536
|
-
[]
|
|
6537
|
-
);
|
|
6538
|
-
}, [contactQuery.data]);
|
|
6539
|
-
return {
|
|
6540
|
-
data,
|
|
6541
|
-
totalCount: contactQuery.hasNextPage ? ((0, import_last.default)(contactQuery.data?.pages ?? [])?.meta.total ?? 0) + 1 : (0, import_last.default)(contactQuery.data?.pages ?? [])?.meta.total ?? 0,
|
|
6542
|
-
loading: contactQuery.isLoading,
|
|
6543
|
-
loadingNextPage: contactQuery.isFetchingNextPage,
|
|
6544
|
-
hasNextPage: contactQuery.hasNextPage,
|
|
6545
|
-
onLoadMore: contactQuery.fetchNextPage
|
|
6546
|
-
};
|
|
6547
|
-
}
|
|
6548
|
-
function useContactSearch(keyword, options) {
|
|
6549
|
-
return (0, import_react_query13.useQuery)({
|
|
6550
|
-
queryKey: ["matchid-contacts-search", keyword],
|
|
6551
|
-
enabled: !!keyword,
|
|
6552
|
-
queryFn: async () => {
|
|
6553
|
-
return (await searchContactsApi({
|
|
6554
|
-
address: keyword
|
|
6555
|
-
})).data;
|
|
6556
|
-
},
|
|
6557
|
-
...options
|
|
6558
|
-
});
|
|
6559
|
-
}
|
|
6560
|
-
function useContactInfo(options) {
|
|
6561
|
-
const { address } = useUserInfo();
|
|
6562
|
-
return (0, import_react_query13.useQuery)({
|
|
6563
|
-
queryKey: ["matchid-contacts-info", address],
|
|
6564
|
-
enabled: !!address,
|
|
6565
|
-
queryFn: async () => {
|
|
6566
|
-
return (await getContractsInfoApi()).data;
|
|
6567
|
-
},
|
|
6568
|
-
...options
|
|
6569
|
-
});
|
|
6570
|
-
}
|
|
6571
|
-
var addContact = async (friend_id) => {
|
|
6572
|
-
const res = await addContactsApi({
|
|
6573
|
-
friend_id: typeof friend_id === "string" ? friend_id : friend_id.did
|
|
6574
|
-
});
|
|
6575
|
-
if (isSuccess(res)) {
|
|
6576
|
-
return true;
|
|
6577
|
-
}
|
|
6578
|
-
throw new Error(res.message);
|
|
6579
|
-
};
|
|
6580
|
-
var acceptContact = async (friend_id) => {
|
|
6581
|
-
const res = await acceptContactsApi({
|
|
6582
|
-
friend_id: typeof friend_id === "string" ? friend_id : friend_id.did
|
|
6583
|
-
});
|
|
6584
|
-
if (isSuccess(res)) {
|
|
6585
|
-
return true;
|
|
6586
|
-
}
|
|
6587
|
-
throw new Error(res.message);
|
|
6588
|
-
};
|
|
6589
|
-
var delContact = async (friend_id) => {
|
|
6590
|
-
const res = await delContactsApi({
|
|
6591
|
-
friend_id: typeof friend_id === "string" ? friend_id : friend_id.did
|
|
6592
|
-
});
|
|
6593
|
-
if (isSuccess(res)) {
|
|
6594
|
-
return true;
|
|
6595
|
-
}
|
|
6596
|
-
throw new Error(res.message);
|
|
6597
|
-
};
|
|
6598
|
-
|
|
6599
|
-
// src/components/ContactList/index.tsx
|
|
6600
|
-
var import_react_virtuoso = require("react-virtuoso");
|
|
6601
|
-
var import_react44 = require("react");
|
|
6602
|
-
var import_react_intl24 = require("react-intl");
|
|
6603
|
-
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
6604
|
-
function ContactCard({
|
|
6605
|
-
loading = false,
|
|
6606
|
-
data,
|
|
6607
|
-
action
|
|
6608
|
-
}) {
|
|
6609
|
-
const isDownMd = useDownMd();
|
|
6610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-flex matchid-contact-item", children: [
|
|
6611
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-contact-item-content", children: [
|
|
6612
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: isDownMd ? 36 : 48, height: isDownMd ? 36 : 48, radius: 100, loading, children: data?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("img", { src: data?.avatar, className: "matchid-contact-item-avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AlphaAvatar, { size: isDownMd ? 36 : 48, name: data?.name || data?.username || "MatchID" }) }),
|
|
6613
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "matchid-contact-item-info", children: [
|
|
6614
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-name", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 80, height: isDownMd ? 16 : 20, loading, children: data?.name || data?.username || "MatchID User" }) }),
|
|
6615
|
-
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-address", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 80, height: isDownMd ? 12 : 16, loading, children: truncateAddress(data?.address || "", 6, 6) }) })
|
|
6616
|
-
] })
|
|
6617
|
-
] }),
|
|
6618
|
-
action && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-contact-item-action", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Skeleton_default, { width: 20, height: 20, loading, children: action() }) })
|
|
6619
|
-
] });
|
|
6620
|
-
}
|
|
6621
|
-
function RequestAction({ data, onSuccess }) {
|
|
6622
|
-
const [loading, setLoading] = (0, import_react44.useState)(false);
|
|
6623
|
-
const toast = useToast();
|
|
6624
|
-
const intl = (0, import_react_intl24.useIntl)();
|
|
6625
|
-
const onApprove = async () => {
|
|
6626
|
-
setLoading(true);
|
|
6627
|
-
try {
|
|
6628
|
-
await contact_exports.acceptContact(data);
|
|
6629
|
-
toast.success(intl.formatMessage({
|
|
6630
|
-
id: "approveSuccess"
|
|
6631
|
-
}));
|
|
6632
|
-
onSuccess && onSuccess(data);
|
|
6633
|
-
} catch (e) {
|
|
6634
|
-
console.error(e);
|
|
6635
|
-
toast.error(e.message);
|
|
6636
|
-
} finally {
|
|
6637
|
-
setLoading(false);
|
|
6638
|
-
}
|
|
6639
|
-
};
|
|
6640
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Button, { size: "sm", onClick: onApprove, loading, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_react_intl24.FormattedMessage, { id: "Approve" }) });
|
|
6641
|
-
}
|
|
6642
|
-
function FriendsAction({
|
|
6643
|
-
data,
|
|
6644
|
-
onSuccess
|
|
6645
|
-
}) {
|
|
6646
|
-
const [loading, setLoading] = (0, import_react44.useState)(false);
|
|
6647
|
-
const toast = useToast();
|
|
6648
|
-
const intl = (0, import_react_intl24.useIntl)();
|
|
6649
|
-
const onRemove = async () => {
|
|
6650
|
-
setLoading(true);
|
|
6651
|
-
try {
|
|
6652
|
-
await contact_exports.delContact(data);
|
|
6653
|
-
toast.success(intl.formatMessage({
|
|
6654
|
-
id: "removeSuccess"
|
|
6655
|
-
}));
|
|
6656
|
-
onSuccess && onSuccess(data);
|
|
6657
|
-
} catch (e) {
|
|
6658
|
-
console.error(e);
|
|
6659
|
-
toast.error(e.message);
|
|
6660
|
-
} finally {
|
|
6661
|
-
setLoading(false);
|
|
6662
|
-
}
|
|
6663
|
-
};
|
|
6664
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Popover, { content: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-remove-box", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Button, { size: "sm", loading, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_react_intl24.FormattedMessage, { id: "Remove" }) }) }), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(MoreIcon, { className: "matchid-cursor-pointer" }) });
|
|
6665
|
-
}
|
|
6666
|
-
function ContactList({
|
|
6667
|
-
limit = 10,
|
|
6668
|
-
height = 660,
|
|
6669
|
-
type = "Friend"
|
|
6670
|
-
}) {
|
|
6671
|
-
const { loading, totalCount, data, onLoadMore } = contact_exports.useContactList(limit, type);
|
|
6672
|
-
const [hiddenList, setHiddenList] = (0, import_react44.useState)([]);
|
|
6673
|
-
const { address } = useWallet();
|
|
6674
|
-
(0, import_react44.useEffect)(() => {
|
|
6675
|
-
setHiddenList([]);
|
|
6676
|
-
}, [type]);
|
|
6677
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
6678
|
-
import_react_virtuoso.Virtuoso,
|
|
6679
|
-
{
|
|
6680
|
-
style: {
|
|
6681
|
-
height
|
|
6682
|
-
},
|
|
6683
|
-
totalCount: loading ? 10 : totalCount,
|
|
6684
|
-
itemContent: (index) => {
|
|
6685
|
-
if (loading || !data[index]) {
|
|
6686
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ContactCard, { loading: true });
|
|
6687
|
-
}
|
|
6688
|
-
if (hiddenList.includes(data[index].limit_id || 0)) {
|
|
6689
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, {});
|
|
6690
|
-
}
|
|
6691
|
-
const item = data[index];
|
|
6692
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ContactCard, { data: item, action: () => {
|
|
6693
|
-
if (address == item.address) {
|
|
6694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, {});
|
|
6695
|
-
}
|
|
6696
|
-
if (type == "Requests") {
|
|
6697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RequestAction, { data: item, onSuccess: (data2) => {
|
|
6698
|
-
setHiddenList([...hiddenList, data2.limit_id || 0]);
|
|
6699
|
-
} });
|
|
6700
|
-
}
|
|
6701
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(FriendsAction, { data: item, onSuccess: (data2) => {
|
|
6702
|
-
setHiddenList([...hiddenList, data2.limit_id || 0]);
|
|
6703
|
-
} });
|
|
6704
|
-
} });
|
|
6705
|
-
},
|
|
6706
|
-
endReached: () => {
|
|
6707
|
-
onLoadMore();
|
|
6708
|
-
},
|
|
6709
|
-
components: {
|
|
6710
|
-
EmptyPlaceholder: () => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-nomore", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_react_intl24.FormattedMessage, { id: type == "Friend" ? "noFriends" : "noRequests" }) }),
|
|
6711
|
-
Footer: data.length > 0 ? () => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "matchid-nomore", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_react_intl24.FormattedMessage, { id: "noMore" }) }) : void 0
|
|
6712
|
-
}
|
|
6713
|
-
}
|
|
6714
|
-
);
|
|
6715
|
-
}
|
|
6716
6372
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6717
6373
|
0 && (module.exports = {
|
|
6718
6374
|
BTCModal,
|
|
6719
6375
|
Button,
|
|
6720
|
-
ContactCard,
|
|
6721
|
-
ContactList,
|
|
6722
6376
|
EVMModal,
|
|
6723
6377
|
EmailModal,
|
|
6724
6378
|
Field,
|