@matchain/matchid-sdk-react 0.1.48-alpha.2 → 0.1.48-alpha.20
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 +12 -2
- package/dist/assets/icon/index.d.ts +12 -2
- package/dist/assets/icon/index.js +93 -2
- package/dist/assets/icon/index.js.map +1 -1
- package/dist/assets/icon/index.mjs +9 -1
- package/dist/{chunk-6HRRPZPM.mjs → chunk-3UVHHJP6.mjs} +2 -2
- package/dist/chunk-5JHHHLG4.mjs +136 -0
- package/dist/chunk-5JHHHLG4.mjs.map +1 -0
- package/dist/{chunk-A5D3NKTK.mjs → chunk-LHNKZISB.mjs} +91 -4
- package/dist/chunk-LHNKZISB.mjs.map +1 -0
- package/dist/{chunk-D6IUBR7S.mjs → chunk-WHZ3HI4R.mjs} +2197 -553
- package/dist/chunk-WHZ3HI4R.mjs.map +1 -0
- package/dist/{chunk-LNSJ3ZXG.mjs → chunk-WXPVHKGJ.mjs} +73 -42
- package/dist/chunk-WXPVHKGJ.mjs.map +1 -0
- package/dist/components/index.d.mts +4 -3
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.js +2283 -525
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +14 -3
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +375 -193
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +5 -4
- package/dist/hooks/index.d.mts +4 -2
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/index.js +1904 -227
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +12 -3
- package/dist/index-BMfaixEx.d.mts +66 -0
- package/dist/{index-DamklTOJ.d.mts → index-BMsj8hJv.d.ts} +4 -3
- package/dist/{index-CKiK4KHj.d.ts → index-BcEreCxd.d.ts} +1 -1
- package/dist/index-Bpmrd7mh.d.ts +66 -0
- package/dist/{index-CGs_yTFg.d.ts → index-Bvc8cjpN.d.ts} +34 -4
- package/dist/{index-C2-M-aBb.d.ts → index-C9F6f2iz.d.mts} +4 -3
- package/dist/{index-M7ZB3yR5.d.mts → index-C9qYyRgt.d.mts} +34 -4
- package/dist/index-CFKZWJVt.d.ts +3306 -0
- package/dist/{index-Bb7IkjUW.d.mts → index-Cou96DpL.d.mts} +1 -1
- package/dist/{index-BIgM4fy0.d.mts → index-Cy3K-Yao.d.ts} +31 -8
- package/dist/{index-BwD1ij0H.d.ts → index-D4ju2J_e.d.mts} +31 -8
- package/dist/index-Dhtyz0pT.d.mts +3306 -0
- package/dist/index.css +587 -6
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +2855 -1015
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/{types-DQq17lf4.d.mts → types-DzVVzMYU.d.mts} +74 -36
- package/dist/{types-DQq17lf4.d.ts → types-DzVVzMYU.d.ts} +74 -36
- package/dist/ui/index.d.mts +4 -3
- package/dist/ui/index.d.ts +4 -3
- package/dist/ui/index.js +140 -95
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +2 -2
- package/dist/utils/index.d.mts +26 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.js +181 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +30 -0
- package/dist/utils/index.mjs.map +1 -0
- package/example/src/pages/Wallet/components/MatchWallet.tsx +24 -10
- package/example/src/pages/Wallet/index.tsx +2 -1
- package/package.json +7 -1
- package/dist/chunk-A5D3NKTK.mjs.map +0 -1
- package/dist/chunk-D6IUBR7S.mjs.map +0 -1
- package/dist/chunk-LNSJ3ZXG.mjs.map +0 -1
- package/dist/index-BHVMQGZj.d.mts +0 -173
- package/dist/index-BVatQlwF.d.mts +0 -59
- package/dist/index-DgAnNnit.d.ts +0 -173
- package/dist/index-RfA22r-Z.d.ts +0 -59
- /package/dist/{chunk-6HRRPZPM.mjs.map → chunk-3UVHHJP6.mjs.map} +0 -0
package/dist/ui/index.mjs
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const getVersion: () => string;
|
|
2
|
+
declare function encodeBase64(input: string): string;
|
|
3
|
+
declare function decodeBase64(input: string): string;
|
|
4
|
+
declare const isValidEmail: (email: string) => boolean;
|
|
5
|
+
declare const isValidUsername: (username: string) => boolean;
|
|
6
|
+
declare const deepMerge: (target: any, source: any) => any;
|
|
7
|
+
declare function truncateAddress(address: string): string;
|
|
8
|
+
declare function firstUpperCase(str: string): string;
|
|
9
|
+
declare function getAppClientId(): string;
|
|
10
|
+
interface NumberFormatterProps {
|
|
11
|
+
value: number | string | undefined;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
separator?: boolean;
|
|
15
|
+
fixNum?: number;
|
|
16
|
+
tFixNum?: number;
|
|
17
|
+
intClassName?: string;
|
|
18
|
+
decimalClassName?: string;
|
|
19
|
+
prefixClassName?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const NumberFormatter: React.FC<NumberFormatterProps>;
|
|
23
|
+
declare function formatAddress(address: string, pre?: number, after?: number): string;
|
|
24
|
+
declare const formatDate: (value: any, formatString?: string) => string;
|
|
25
|
+
|
|
26
|
+
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion, isValidEmail, isValidUsername, truncateAddress };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const getVersion: () => string;
|
|
2
|
+
declare function encodeBase64(input: string): string;
|
|
3
|
+
declare function decodeBase64(input: string): string;
|
|
4
|
+
declare const isValidEmail: (email: string) => boolean;
|
|
5
|
+
declare const isValidUsername: (username: string) => boolean;
|
|
6
|
+
declare const deepMerge: (target: any, source: any) => any;
|
|
7
|
+
declare function truncateAddress(address: string): string;
|
|
8
|
+
declare function firstUpperCase(str: string): string;
|
|
9
|
+
declare function getAppClientId(): string;
|
|
10
|
+
interface NumberFormatterProps {
|
|
11
|
+
value: number | string | undefined;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
separator?: boolean;
|
|
15
|
+
fixNum?: number;
|
|
16
|
+
tFixNum?: number;
|
|
17
|
+
intClassName?: string;
|
|
18
|
+
decimalClassName?: string;
|
|
19
|
+
prefixClassName?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const NumberFormatter: React.FC<NumberFormatterProps>;
|
|
23
|
+
declare function formatAddress(address: string, pre?: number, after?: number): string;
|
|
24
|
+
declare const formatDate: (value: any, formatString?: string) => string;
|
|
25
|
+
|
|
26
|
+
export { NumberFormatter, decodeBase64, deepMerge, encodeBase64, firstUpperCase, formatAddress, formatDate, getAppClientId, getVersion, isValidEmail, isValidUsername, truncateAddress };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/utils/index.tsx
|
|
31
|
+
var utils_exports = {};
|
|
32
|
+
__export(utils_exports, {
|
|
33
|
+
NumberFormatter: () => NumberFormatter,
|
|
34
|
+
decodeBase64: () => decodeBase64,
|
|
35
|
+
deepMerge: () => deepMerge,
|
|
36
|
+
encodeBase64: () => encodeBase64,
|
|
37
|
+
firstUpperCase: () => firstUpperCase,
|
|
38
|
+
formatAddress: () => formatAddress,
|
|
39
|
+
formatDate: () => formatDate,
|
|
40
|
+
getAppClientId: () => getAppClientId,
|
|
41
|
+
getVersion: () => getVersion,
|
|
42
|
+
isValidEmail: () => isValidEmail,
|
|
43
|
+
isValidUsername: () => isValidUsername,
|
|
44
|
+
truncateAddress: () => truncateAddress
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(utils_exports);
|
|
47
|
+
var import_moment = __toESM(require("moment"));
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
var getVersion = () => {
|
|
50
|
+
return "0.0.2";
|
|
51
|
+
};
|
|
52
|
+
function encodeBase64(input) {
|
|
53
|
+
return btoa(unescape(encodeURIComponent(input)));
|
|
54
|
+
}
|
|
55
|
+
function decodeBase64(input) {
|
|
56
|
+
return decodeURIComponent(escape(atob(input)));
|
|
57
|
+
}
|
|
58
|
+
var isValidEmail = (email) => {
|
|
59
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
60
|
+
};
|
|
61
|
+
var isValidUsername = (username) => {
|
|
62
|
+
return /^[a-zA-Z0-9_-]+$/.test(username);
|
|
63
|
+
};
|
|
64
|
+
var deepMerge = (target, source) => {
|
|
65
|
+
for (const key in source) {
|
|
66
|
+
if (source[key] instanceof Object && key in target) {
|
|
67
|
+
target[key] = deepMerge(target[key], source[key]);
|
|
68
|
+
} else {
|
|
69
|
+
target[key] = source[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return target;
|
|
73
|
+
};
|
|
74
|
+
function truncateAddress(address) {
|
|
75
|
+
if (address.length <= 6) {
|
|
76
|
+
return address;
|
|
77
|
+
}
|
|
78
|
+
const start = address.slice(0, 4);
|
|
79
|
+
const end = address.slice(-2);
|
|
80
|
+
return `${start}...${end}`;
|
|
81
|
+
}
|
|
82
|
+
function firstUpperCase(str) {
|
|
83
|
+
return str.toString()[0].toUpperCase() + str.toString().slice(1);
|
|
84
|
+
}
|
|
85
|
+
function getAppClientId() {
|
|
86
|
+
return "react-sdk-" + getVersion();
|
|
87
|
+
}
|
|
88
|
+
function convertScientificToDecimal(num) {
|
|
89
|
+
let str = num.toFixed(12);
|
|
90
|
+
str = str.replace(/0+$/, "");
|
|
91
|
+
str = str.replace(/\.$/, "");
|
|
92
|
+
return str;
|
|
93
|
+
}
|
|
94
|
+
var NumberFormatter = ({
|
|
95
|
+
value,
|
|
96
|
+
prefix = "",
|
|
97
|
+
suffix = "",
|
|
98
|
+
separator = true,
|
|
99
|
+
fixNum = 2,
|
|
100
|
+
tFixNum = 4,
|
|
101
|
+
intClassName = "",
|
|
102
|
+
decimalClassName = "",
|
|
103
|
+
prefixClassName = "",
|
|
104
|
+
className = ""
|
|
105
|
+
}) => {
|
|
106
|
+
const numberValue = typeof value === "number" ? convertScientificToDecimal(value) : value ? value : "0";
|
|
107
|
+
const [intPart, decimalPart] = numberValue.toString().split(".");
|
|
108
|
+
const intFormat = separator ? intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : intPart;
|
|
109
|
+
if (Math.abs(parseFloat(numberValue)) >= 1) {
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className, children: [
|
|
111
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intFormat }),
|
|
113
|
+
decimalPart ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: decimalClassName, children: [
|
|
114
|
+
".",
|
|
115
|
+
decimalPart.substring(0, fixNum)
|
|
116
|
+
] }) : "",
|
|
117
|
+
suffix
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
if (decimalPart) {
|
|
121
|
+
let zeroCount = 0;
|
|
122
|
+
for (let i = 0; i < decimalPart.length; i++) {
|
|
123
|
+
if (decimalPart[i] === "0") {
|
|
124
|
+
zeroCount++;
|
|
125
|
+
} else {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (zeroCount < tFixNum) {
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
131
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intFormat }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: decimalClassName, children: [
|
|
134
|
+
".",
|
|
135
|
+
decimalPart.substring(0, tFixNum)
|
|
136
|
+
] }),
|
|
137
|
+
suffix
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
141
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intFormat }),
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: decimalClassName, children: [
|
|
144
|
+
".0",
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("sub", { children: zeroCount }),
|
|
146
|
+
decimalPart?.substring(zeroCount, zeroCount + tFixNum - 2)
|
|
147
|
+
] }),
|
|
148
|
+
suffix
|
|
149
|
+
] });
|
|
150
|
+
}
|
|
151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className, children: [
|
|
152
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: prefixClassName, children: prefix }),
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: intClassName, children: intPart }),
|
|
154
|
+
suffix
|
|
155
|
+
] });
|
|
156
|
+
};
|
|
157
|
+
function formatAddress(address, pre = 4, after = 5) {
|
|
158
|
+
return `${address.substring(0, pre)}...${address.substring(address.length - after, address.length)}`;
|
|
159
|
+
}
|
|
160
|
+
var formatDate = (value, formatString = "YYYY-MM-DD HH:mm:ss") => {
|
|
161
|
+
if (value) {
|
|
162
|
+
return import_moment.default.unix(value).format(formatString);
|
|
163
|
+
}
|
|
164
|
+
return "--";
|
|
165
|
+
};
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
NumberFormatter,
|
|
169
|
+
decodeBase64,
|
|
170
|
+
deepMerge,
|
|
171
|
+
encodeBase64,
|
|
172
|
+
firstUpperCase,
|
|
173
|
+
formatAddress,
|
|
174
|
+
formatDate,
|
|
175
|
+
getAppClientId,
|
|
176
|
+
getVersion,
|
|
177
|
+
isValidEmail,
|
|
178
|
+
isValidUsername,
|
|
179
|
+
truncateAddress
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.tsx"],"sourcesContent":["import moment from 'moment';\n\nexport const getVersion = (): string => {\n return \"0.0.2\";\n};\n\nexport function encodeBase64(input: string) {\n return btoa(unescape(encodeURIComponent(input)));\n}\n\nexport function decodeBase64(input: string) {\n return decodeURIComponent(escape(atob(input)));\n}\n\nexport const isValidEmail = (email: string) => {\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)\n}\nexport const isValidUsername = (username: string) => {\n //8-32 alpha number - _\n return /^[a-zA-Z0-9_-]+$/.test(username)\n}\n\nexport const deepMerge = (target: any, source: any): any => {\n for (const key in source) {\n if (source[key] instanceof Object && key in target) {\n target[key] = deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n return target;\n};\n\nexport function truncateAddress(address: string): string {\n if (address.length <= 6) {\n return address;\n }\n const start = address.slice(0, 4);\n const end = address.slice(-2);\n return `${start}...${end}`;\n}\n\n\nexport function firstUpperCase(str: string): string {\n return str.toString()[0].toUpperCase() + str.toString().slice(1);\n}\n\nexport function getAppClientId() {\n return \"react-sdk-\" + getVersion()\n}\n\n\nfunction convertScientificToDecimal(num: number) {\n let str = num.toFixed(12)\n str = str.replace(/0+$/, '')\n str = str.replace(/\\.$/, '')\n return str\n}\n\ninterface NumberFormatterProps {\n value: number | string | undefined\n prefix?: string\n suffix?: string\n separator?: boolean\n fixNum?: number //number >= 1 fix num\n tFixNum?: number //number < 1 fix num\n intClassName?: string\n decimalClassName?: string\n prefixClassName?: string\n className?: string\n}\n\nexport const NumberFormatter: React.FC<NumberFormatterProps> = ({\n value,\n prefix = '',\n suffix = '',\n separator = true,\n fixNum = 2,\n tFixNum = 4,\n intClassName = \"\",\n decimalClassName = \"\",\n prefixClassName = \"\",\n className = \"\"\n }) => {\n const numberValue =\n typeof value === 'number'\n ? convertScientificToDecimal(value)\n : value\n ? value\n : '0'\n\n const [intPart, decimalPart] = numberValue.toString().split('.')\n\n const intFormat = separator\n ? intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')\n : intPart\n\n if (Math.abs(parseFloat(numberValue)) >= 1) {\n return (\n <span className={className}>\n {prefix && <span className={prefixClassName}>{prefix}</span>}\n <span className={intClassName}>{intFormat}</span>\n {decimalPart ? (\n <span className={decimalClassName}>\n .{decimalPart.substring(0, fixNum)}\n </span>\n ) : (\n ''\n )}\n {suffix}\n </span>\n )\n }\n\n if (decimalPart) {\n let zeroCount = 0\n for (let i = 0; i < decimalPart.length; i++) {\n if (decimalPart[i] === '0') {\n zeroCount++\n } else {\n break\n }\n }\n if (zeroCount < tFixNum) {\n return (\n <span>\n {prefix && <span className={prefixClassName}>{prefix}</span>}\n <span className={intClassName}>{intFormat}</span>\n <span className={decimalClassName}>\n .{decimalPart.substring(0, tFixNum)}\n </span>\n {suffix}\n </span>\n )\n }\n return (\n <span>\n {prefix && <span className={prefixClassName}>{prefix}</span>}\n <span className={intClassName}>{intFormat}</span>\n <span className={decimalClassName}>\n .0<sub>{zeroCount}</sub>\n {decimalPart?.substring(zeroCount, zeroCount + tFixNum - 2)}\n </span>\n {suffix}\n </span>\n )\n }\n return (\n <span className={className}>\n {prefix && <span className={prefixClassName}>{prefix}</span>}\n <span className={intClassName}>{intPart}</span>\n {suffix}\n </span>\n )\n}\n\nexport function formatAddress(address: string,pre=4,after=5) {\n return `${address.substring(0, pre)}...${address.substring(address.length - after, address.length)}`\n}\n\nexport const formatDate = (value: any, formatString = 'YYYY-MM-DD HH:mm:ss') => {\n if (value) {\n return moment.unix(value).format(formatString)\n }\n return '--'\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AAoGI;AAlGhB,IAAM,aAAa,MAAc;AACpC,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AAK,qBAAU;AAAA,QACb,aAAa,UAAU,WAAW,YAAY,UAAU,CAAC;AAAA,SAClE;AAAA,MACC;AAAA,OACD;AAAA,EAEZ;AACA,SACI,6CAAC,UAAK,WACO;AAAA,cAAU,4CAAC,UAAK,WAAW,iBAAkB,kBAAO;AAAA,IAC7D,4CAAC,UAAK,WAAW,cAAe,mBAAQ;AAAA,IACvC;AAAA,KACG;AAEhB;AAEO,SAAS,cAAc,SAAgB,MAAI,GAAE,QAAM,GAAG;AACzD,SAAO,GAAG,QAAQ,UAAU,GAAG,GAAG,CAAC,MAAM,QAAQ,UAAU,QAAQ,SAAS,OAAO,QAAQ,MAAM,CAAC;AACtG;AAEO,IAAM,aAAa,CAAC,OAAY,eAAe,0BAA0B;AAC5E,MAAI,OAAO;AACP,WAAO,cAAAA,QAAO,KAAK,KAAK,EAAE,OAAO,YAAY;AAAA,EACjD;AACA,SAAO;AACX;","names":["moment"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NumberFormatter,
|
|
3
|
+
decodeBase64,
|
|
4
|
+
deepMerge,
|
|
5
|
+
encodeBase64,
|
|
6
|
+
firstUpperCase,
|
|
7
|
+
formatAddress,
|
|
8
|
+
formatDate,
|
|
9
|
+
getAppClientId,
|
|
10
|
+
getVersion,
|
|
11
|
+
isValidEmail,
|
|
12
|
+
isValidUsername,
|
|
13
|
+
truncateAddress
|
|
14
|
+
} from "../chunk-5JHHHLG4.mjs";
|
|
15
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
16
|
+
export {
|
|
17
|
+
NumberFormatter,
|
|
18
|
+
decodeBase64,
|
|
19
|
+
deepMerge,
|
|
20
|
+
encodeBase64,
|
|
21
|
+
firstUpperCase,
|
|
22
|
+
formatAddress,
|
|
23
|
+
formatDate,
|
|
24
|
+
getAppClientId,
|
|
25
|
+
getVersion,
|
|
26
|
+
isValidEmail,
|
|
27
|
+
isValidUsername,
|
|
28
|
+
truncateAddress
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import {useMatchChain,useMatchWallet} from "@matchain/matchid-sdk-react/hooks";
|
|
2
|
-
import {Button} from "@matchain/matchid-sdk-react/
|
|
1
|
+
import {useMatchChain, useMatchWallet, useMatchWalletAssets, useModal} from "@matchain/matchid-sdk-react/hooks";
|
|
2
|
+
import {Button} from "@matchain/matchid-sdk-react/ui";
|
|
3
|
+
import {WalletAsset, TokenDetail,TransactionList} from "@matchain/matchid-sdk-react/components";
|
|
4
|
+
import ButtonGroup from "@/components/ButtonGroup";
|
|
5
|
+
import {WalletAssetMergeType} from "@matchain/matchid-sdk-react/types";
|
|
3
6
|
|
|
4
|
-
export default function MatchWallet(){
|
|
7
|
+
export default function MatchWallet() {
|
|
5
8
|
const chain = useMatchChain()
|
|
6
9
|
const wallet = useMatchWallet()
|
|
10
|
+
const modal = useModal()
|
|
11
|
+
const onAssetClick = (asset: WalletAssetMergeType) => {
|
|
12
|
+
return () => {
|
|
13
|
+
modal.show((props) => {
|
|
14
|
+
return <TokenDetail onClose={props.close} token={asset}/>
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
return (
|
|
8
19
|
<div className={"mt-[50px]"}>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
{chain.chain?.id}:{chain.chain?.name}
|
|
12
|
-
<Button size={"sm"} onClick={chain.showChangeNetwork}>ChangeNetwork</Button>
|
|
13
|
-
</div>
|
|
14
|
-
<div>
|
|
20
|
+
<ButtonGroup title={"CustomWalletUI"}></ButtonGroup>
|
|
21
|
+
<ButtonGroup>
|
|
22
|
+
<Button size={"sm"} onClick={chain.showChangeNetwork}>{chain.chain?.id}:{chain.chain?.name}</Button>
|
|
15
23
|
<Button size={"sm"} onClick={wallet.showReceiveModal}>ShowReceive</Button>
|
|
16
|
-
|
|
24
|
+
<Button size={"sm"} onClick={wallet.showImportTokenModal}>showImportToken</Button>
|
|
25
|
+
<Button size={"sm"} onClick={wallet.showSendListModal}>showSendListModal</Button>
|
|
26
|
+
</ButtonGroup>
|
|
27
|
+
<div className={`mt-[100px] gap-[20px] grid grid-cols-2`}>
|
|
28
|
+
<WalletAsset onAssetClick={onAssetClick}/>
|
|
29
|
+
<TransactionList/>
|
|
17
30
|
</div>
|
|
31
|
+
|
|
18
32
|
</div>
|
|
19
33
|
)
|
|
20
34
|
}
|
|
@@ -143,7 +143,8 @@ export default function Wallet() {
|
|
|
143
143
|
to: toAddress as `0x${string}`,
|
|
144
144
|
value: parseUnits(toAmount, 18),
|
|
145
145
|
data: data as `0x${string}`,
|
|
146
|
-
chain: chain
|
|
146
|
+
chain: chain,
|
|
147
|
+
type:"legacy"
|
|
147
148
|
}
|
|
148
149
|
const request = await walletClient.prepareTransactionRequest(transaction)
|
|
149
150
|
const res = await evmAccount.signTransaction!(request as TransactionSerializable)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matchain/matchid-sdk-react",
|
|
3
|
-
"version": "0.1.48-alpha.
|
|
3
|
+
"version": "0.1.48-alpha.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"import": "./dist/types/index.mjs",
|
|
37
37
|
"require": "./dist/types/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./utils": {
|
|
40
|
+
"import": "./dist/utils/index.mjs",
|
|
41
|
+
"require": "./dist/utils/index.js"
|
|
42
|
+
},
|
|
39
43
|
"./index.css": "./dist/index.css"
|
|
40
44
|
},
|
|
41
45
|
"scripts": {
|
|
@@ -72,6 +76,8 @@
|
|
|
72
76
|
"axios-retry": "^4.5.0",
|
|
73
77
|
"copy-to-clipboard": "^3.3.3",
|
|
74
78
|
"ethers": "^5.7.2",
|
|
79
|
+
"moment": "^2.30.1",
|
|
80
|
+
"react-infinite-scroll-component": "^6.1.0",
|
|
75
81
|
"react-intl": "^7.1.0",
|
|
76
82
|
"react-qrcode": "^0.3.6",
|
|
77
83
|
"react-router-dom": "^6.0.0",
|