@matchain/matchid-sdk-react 0.1.53-alpha.1 → 0.1.53-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.
- package/dist/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-6QTW3KXN.mjs → chunk-4A2YPGO3.mjs} +2 -2
- package/dist/{chunk-HLUFAIFV.mjs → chunk-MX7N57AH.mjs} +1 -1
- package/dist/{chunk-HLUFAIFV.mjs.map → chunk-MX7N57AH.mjs.map} +1 -1
- package/dist/{chunk-2DVC6WCN.mjs → chunk-W5A6WY7Y.mjs} +228 -415
- package/dist/chunk-W5A6WY7Y.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 +222 -394
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -4
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +74 -121
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +252 -312
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-DMUZQqNB.d.ts → index-B8cUP7cH.d.ts} +2 -2
- package/dist/{index-Bmir-Wor.d.mts → index-BCGJczpk.d.mts} +1 -1
- package/dist/{index-B-QfwtE5.d.mts → index-BS-NO8Y2.d.ts} +3 -3
- package/dist/{index-X_fw5wX_.d.ts → index-Bil_db2f.d.mts} +3 -3
- package/dist/{index-BUj9mOrS.d.ts → index-BsL6zo6a.d.ts} +1 -1
- package/dist/{index-CDqIk5k2.d.mts → index-CZqdmQu1.d.mts} +1 -1
- package/dist/{index-BDoEk1EK.d.ts → index-DNJuiNdz.d.mts} +4 -11
- package/dist/{index-XzSw1Bym.d.mts → index-Df-WlkXq.d.ts} +4 -11
- package/dist/{index-k2Uf0F94.d.ts → index-IwwXQ_QV.d.ts} +1 -1
- package/dist/{index-DvM6x6e6.d.ts → index-K5vXmiRX.d.ts} +1 -1
- package/dist/{index-B_o9HBS1.d.mts → index-iWHaT8HV.d.mts} +1 -1
- package/dist/{index-D5OzNRfu.d.mts → index-yy3VTdFU.d.mts} +2 -2
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +388 -537
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-Dd_ExpLx.d.mts → types-CZbR7ERa.d.mts} +0 -1
- package/dist/{types-Dd_ExpLx.d.ts → types-CZbR7ERa.d.ts} +0 -1
- package/dist/ui/index.d.mts +3 -3
- package/dist/ui/index.d.ts +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -5
- package/dist/chunk-2DVC6WCN.mjs.map +0 -1
- /package/dist/{chunk-6QTW3KXN.mjs.map → chunk-4A2YPGO3.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -43,7 +43,6 @@ __export(components_exports, {
|
|
|
43
43
|
ModalWithHeader: () => ModalWithHeader,
|
|
44
44
|
Overlay: () => Overlay,
|
|
45
45
|
Popover: () => Popover,
|
|
46
|
-
SOLModal: () => SOLModal,
|
|
47
46
|
TONModal: () => TONModal,
|
|
48
47
|
TRONModal: () => TRONModal,
|
|
49
48
|
TokenDetail: () => TokenDetail,
|
|
@@ -3073,12 +3072,6 @@ function useWalletConfig() {
|
|
|
3073
3072
|
}
|
|
3074
3073
|
|
|
3075
3074
|
// src/store/useModalStore.ts
|
|
3076
|
-
var useSOLModalStore = (0, import_zustand5.create)((set) => ({
|
|
3077
|
-
isOpen: false,
|
|
3078
|
-
type: "",
|
|
3079
|
-
open: (type) => set({ isOpen: true, type }),
|
|
3080
|
-
close: () => set({ isOpen: false })
|
|
3081
|
-
}));
|
|
3082
3075
|
var useTRONModalStore = (0, import_zustand5.create)((set) => ({
|
|
3083
3076
|
isOpen: false,
|
|
3084
3077
|
type: "",
|
|
@@ -3160,13 +3153,16 @@ function useUserInfo() {
|
|
|
3160
3153
|
refreshOverview
|
|
3161
3154
|
} = useLocalStore_default();
|
|
3162
3155
|
const { setTgAppAuthCode, emailLoginKey, setEmailLoginKey } = useStore_default();
|
|
3156
|
+
const isDownMd = useDownMd();
|
|
3163
3157
|
const { events, login } = useMatch();
|
|
3164
|
-
const { open: SOLOpen } = useSOLModalStore();
|
|
3165
3158
|
const { open: TRONOpen } = useTRONModalStore();
|
|
3166
3159
|
const { open: TONOpen } = useTONModalStore();
|
|
3167
3160
|
const { open: BTCOpen } = useBTCModalStore();
|
|
3168
3161
|
const { open: CEXBindOpen } = useCEXBindModalStore();
|
|
3169
3162
|
const walletModalStore = useWalletModalStore();
|
|
3163
|
+
const getRedirectUri = () => {
|
|
3164
|
+
return encodeURIComponent(window.location.href);
|
|
3165
|
+
};
|
|
3170
3166
|
const isLogin = (0, import_react22.useMemo)(() => !!token && !!overview, [token, overview]);
|
|
3171
3167
|
const logout = async () => {
|
|
3172
3168
|
try {
|
|
@@ -3237,6 +3233,9 @@ function useUserInfo() {
|
|
|
3237
3233
|
case "evm":
|
|
3238
3234
|
return window.open(`${endpoints.auth}login/wallet?appid=${appid}&locale=${locale}`);
|
|
3239
3235
|
case "sol":
|
|
3236
|
+
if (isDownMd) {
|
|
3237
|
+
return window.location.href = `${endpoints.auth}login/sol?appid=${appid}&locale=${locale}&redirect_uri=${getRedirectUri()}`;
|
|
3238
|
+
}
|
|
3240
3239
|
return window.open(`${endpoints.auth}login/sol?appid=${appid}&locale=${locale}`);
|
|
3241
3240
|
case "tron":
|
|
3242
3241
|
return TRONOpen("login");
|
|
@@ -3279,7 +3278,7 @@ function useUserInfo() {
|
|
|
3279
3278
|
const res = await verifyEmailCodeApi(obj);
|
|
3280
3279
|
if (res && res.data && isSuccess(res)) {
|
|
3281
3280
|
await login({
|
|
3282
|
-
mid: res.data.mid,
|
|
3281
|
+
// mid: res.data.mid,
|
|
3283
3282
|
token: `${res.data.token_type} ${res.data.access_token}`
|
|
3284
3283
|
});
|
|
3285
3284
|
return true;
|
|
@@ -3326,7 +3325,10 @@ function useUserInfo() {
|
|
|
3326
3325
|
case "evm":
|
|
3327
3326
|
return window.open(`${endpoints.auth}bind/wallet?appid=${appid}&locale=${locale}&st=` + encodeURIComponent(encodeBase64(token)));
|
|
3328
3327
|
case "sol":
|
|
3329
|
-
|
|
3328
|
+
if (isDownMd) {
|
|
3329
|
+
return window.location.href = `${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}&redirect_uri=${getRedirectUri()}`;
|
|
3330
|
+
}
|
|
3331
|
+
return window.open(`${endpoints.auth}bind/sol?appid=${appid}&locale=${locale}&st=${encodeURIComponent(encodeBase64(token))}`);
|
|
3330
3332
|
case "tron":
|
|
3331
3333
|
return TRONOpen("bind");
|
|
3332
3334
|
case "ton":
|
|
@@ -4124,23 +4126,8 @@ function UsernameModal({
|
|
|
4124
4126
|
] }) });
|
|
4125
4127
|
}
|
|
4126
4128
|
|
|
4127
|
-
// src/components/
|
|
4128
|
-
var
|
|
4129
|
-
var import_web3 = require("@solana/web3.js");
|
|
4130
|
-
var import_wallet_adapter_react = require("@solana/wallet-adapter-react");
|
|
4131
|
-
var import_wallet_adapter_react_ui = require("@solana/wallet-adapter-react-ui");
|
|
4132
|
-
|
|
4133
|
-
// node_modules/@solana/wallet-adapter-base/lib/esm/types.js
|
|
4134
|
-
var WalletAdapterNetwork;
|
|
4135
|
-
(function(WalletAdapterNetwork2) {
|
|
4136
|
-
WalletAdapterNetwork2["Mainnet"] = "mainnet-beta";
|
|
4137
|
-
WalletAdapterNetwork2["Testnet"] = "testnet";
|
|
4138
|
-
WalletAdapterNetwork2["Devnet"] = "devnet";
|
|
4139
|
-
})(WalletAdapterNetwork || (WalletAdapterNetwork = {}));
|
|
4140
|
-
|
|
4141
|
-
// src/components/SOLModal/index.tsx
|
|
4142
|
-
var import_wallet_adapter_wallets = require("@solana/wallet-adapter-wallets");
|
|
4143
|
-
var import_styles = require("@solana/wallet-adapter-react-ui/styles.css");
|
|
4129
|
+
// src/components/TRONModal/index.tsx
|
|
4130
|
+
var import_react31 = __toESM(require("react"));
|
|
4144
4131
|
var import_react_intl14 = require("react-intl");
|
|
4145
4132
|
|
|
4146
4133
|
// src/components/WalletModalContent/index.tsx
|
|
@@ -4243,164 +4230,6 @@ function WalletModalContent({
|
|
|
4243
4230
|
] }) });
|
|
4244
4231
|
}
|
|
4245
4232
|
|
|
4246
|
-
// src/components/SOLModal/index.tsx
|
|
4247
|
-
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
4248
|
-
function WalletContent({
|
|
4249
|
-
onSuccess,
|
|
4250
|
-
type
|
|
4251
|
-
}) {
|
|
4252
|
-
const { setVisible, visible } = (0, import_wallet_adapter_react_ui.useWalletModal)();
|
|
4253
|
-
const wallet = (0, import_wallet_adapter_react.useWallet)();
|
|
4254
|
-
const { events, login } = useMatch();
|
|
4255
|
-
const [status, setStatus] = (0, import_react30.useState)("");
|
|
4256
|
-
const statusRef = import_react30.default.useRef(status);
|
|
4257
|
-
const [error, setError] = (0, import_react30.useState)("");
|
|
4258
|
-
(0, import_react30.useEffect)(() => {
|
|
4259
|
-
const init = async () => {
|
|
4260
|
-
await wallet.disconnect();
|
|
4261
|
-
setVisible(true);
|
|
4262
|
-
};
|
|
4263
|
-
init();
|
|
4264
|
-
}, []);
|
|
4265
|
-
(0, import_react30.useEffect)(() => {
|
|
4266
|
-
if (wallet.connected) {
|
|
4267
|
-
console.log("wallet.connected", wallet.connected);
|
|
4268
|
-
toLoginInWallet();
|
|
4269
|
-
}
|
|
4270
|
-
}, [wallet.connected]);
|
|
4271
|
-
const toLoginInWallet = async () => {
|
|
4272
|
-
if (statusRef.current) return;
|
|
4273
|
-
const address = wallet.publicKey?.toBase58() || "";
|
|
4274
|
-
try {
|
|
4275
|
-
setStatus("nonce");
|
|
4276
|
-
statusRef.current = "nonce";
|
|
4277
|
-
const res = type == "bind" ? await getWalletInitApi({
|
|
4278
|
-
address,
|
|
4279
|
-
type: "SOL"
|
|
4280
|
-
}) : await getWalletNonceApi({ address, type: "SOL" });
|
|
4281
|
-
if (!isSuccess(res)) {
|
|
4282
|
-
throw new Error(res.message);
|
|
4283
|
-
}
|
|
4284
|
-
const nonce = res.code >= 0 ? res.data.nonce : null;
|
|
4285
|
-
if (nonce) {
|
|
4286
|
-
setStatus("signer");
|
|
4287
|
-
statusRef.current = "signer";
|
|
4288
|
-
const message = "By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.Nonce:" + res.data.nonce;
|
|
4289
|
-
const encodedMessage = new TextEncoder().encode(message);
|
|
4290
|
-
const signedMessage = await wallet.signMessage(encodedMessage);
|
|
4291
|
-
let obj = {
|
|
4292
|
-
type: "SOL",
|
|
4293
|
-
address,
|
|
4294
|
-
signature: Buffer.from(signedMessage).toString("base64"),
|
|
4295
|
-
message,
|
|
4296
|
-
connector_type: "SOL",
|
|
4297
|
-
wallet_client_type: wallet.wallet?.adapter.name || ""
|
|
4298
|
-
};
|
|
4299
|
-
const res1 = type == "bind" ? await toBindWalletApi(obj) : await loginByWalletApi(obj);
|
|
4300
|
-
if (res1) {
|
|
4301
|
-
if (!isSuccess(res1)) {
|
|
4302
|
-
throw new Error(res1.message);
|
|
4303
|
-
}
|
|
4304
|
-
matchlog_default.log(res1);
|
|
4305
|
-
setStatus("success");
|
|
4306
|
-
statusRef.current = "success";
|
|
4307
|
-
if (type == "bind") {
|
|
4308
|
-
events.onBind && events.onBind({
|
|
4309
|
-
type: "sol"
|
|
4310
|
-
});
|
|
4311
|
-
eventManager_default.emit("onBind", {
|
|
4312
|
-
type: "sol"
|
|
4313
|
-
});
|
|
4314
|
-
} else {
|
|
4315
|
-
await login({
|
|
4316
|
-
mid: res1.data.mid,
|
|
4317
|
-
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4318
|
-
});
|
|
4319
|
-
}
|
|
4320
|
-
onSuccess && onSuccess();
|
|
4321
|
-
}
|
|
4322
|
-
}
|
|
4323
|
-
} catch (error2) {
|
|
4324
|
-
setStatus("error");
|
|
4325
|
-
setError(error2.message);
|
|
4326
|
-
statusRef.current = "";
|
|
4327
|
-
}
|
|
4328
|
-
};
|
|
4329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4330
|
-
WalletModalContent,
|
|
4331
|
-
{
|
|
4332
|
-
connected: wallet.connected,
|
|
4333
|
-
disconnect: wallet.disconnect,
|
|
4334
|
-
address: wallet.publicKey?.toBase58(),
|
|
4335
|
-
visible,
|
|
4336
|
-
setVisible,
|
|
4337
|
-
error,
|
|
4338
|
-
setError,
|
|
4339
|
-
status
|
|
4340
|
-
}
|
|
4341
|
-
);
|
|
4342
|
-
}
|
|
4343
|
-
var wallets = [
|
|
4344
|
-
new import_wallet_adapter_wallets.PhantomWalletAdapter(),
|
|
4345
|
-
new import_wallet_adapter_wallets.SolflareWalletAdapter(),
|
|
4346
|
-
new import_wallet_adapter_wallets.WalletConnectWalletAdapter({
|
|
4347
|
-
network: WalletAdapterNetwork.Mainnet,
|
|
4348
|
-
options: {
|
|
4349
|
-
relayUrl: "wss://relay.walletconnect.com"
|
|
4350
|
-
}
|
|
4351
|
-
}),
|
|
4352
|
-
new import_wallet_adapter_wallets.AlphaWalletAdapter(),
|
|
4353
|
-
new import_wallet_adapter_wallets.AvanaWalletAdapter(),
|
|
4354
|
-
new import_wallet_adapter_wallets.BitgetWalletAdapter(),
|
|
4355
|
-
new import_wallet_adapter_wallets.BitpieWalletAdapter(),
|
|
4356
|
-
new import_wallet_adapter_wallets.CloverWalletAdapter(),
|
|
4357
|
-
new import_wallet_adapter_wallets.Coin98WalletAdapter(),
|
|
4358
|
-
new import_wallet_adapter_wallets.CoinbaseWalletAdapter(),
|
|
4359
|
-
new import_wallet_adapter_wallets.CoinhubWalletAdapter(),
|
|
4360
|
-
new import_wallet_adapter_wallets.FractalWalletAdapter(),
|
|
4361
|
-
new import_wallet_adapter_wallets.HuobiWalletAdapter(),
|
|
4362
|
-
new import_wallet_adapter_wallets.HyperPayWalletAdapter(),
|
|
4363
|
-
new import_wallet_adapter_wallets.KeystoneWalletAdapter(),
|
|
4364
|
-
new import_wallet_adapter_wallets.KrystalWalletAdapter(),
|
|
4365
|
-
new import_wallet_adapter_wallets.LedgerWalletAdapter(),
|
|
4366
|
-
new import_wallet_adapter_wallets.MathWalletAdapter(),
|
|
4367
|
-
new import_wallet_adapter_wallets.NekoWalletAdapter(),
|
|
4368
|
-
new import_wallet_adapter_wallets.NightlyWalletAdapter(),
|
|
4369
|
-
new import_wallet_adapter_wallets.NufiWalletAdapter(),
|
|
4370
|
-
new import_wallet_adapter_wallets.OntoWalletAdapter(),
|
|
4371
|
-
new import_wallet_adapter_wallets.ParticleAdapter(),
|
|
4372
|
-
new import_wallet_adapter_wallets.SafePalWalletAdapter(),
|
|
4373
|
-
new import_wallet_adapter_wallets.SaifuWalletAdapter(),
|
|
4374
|
-
new import_wallet_adapter_wallets.SalmonWalletAdapter(),
|
|
4375
|
-
new import_wallet_adapter_wallets.SkyWalletAdapter(),
|
|
4376
|
-
new import_wallet_adapter_wallets.SolongWalletAdapter(),
|
|
4377
|
-
new import_wallet_adapter_wallets.SpotWalletAdapter(),
|
|
4378
|
-
new import_wallet_adapter_wallets.TokenaryWalletAdapter(),
|
|
4379
|
-
new import_wallet_adapter_wallets.TokenPocketWalletAdapter(),
|
|
4380
|
-
new import_wallet_adapter_wallets.TorusWalletAdapter(),
|
|
4381
|
-
new import_wallet_adapter_wallets.TrustWalletAdapter(),
|
|
4382
|
-
new import_wallet_adapter_wallets.XDEFIWalletAdapter()
|
|
4383
|
-
];
|
|
4384
|
-
function SOLConnectModal({
|
|
4385
|
-
type = "login",
|
|
4386
|
-
onSuccess,
|
|
4387
|
-
...props
|
|
4388
|
-
}) {
|
|
4389
|
-
const intl = (0, import_react_intl14.useIntl)();
|
|
4390
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4391
|
-
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4392
|
-
}, {
|
|
4393
|
-
name: "SOL"
|
|
4394
|
-
}), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_wallet_adapter_react.ConnectionProvider, { endpoint: (0, import_web3.clusterApiUrl)("devnet"), children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_wallet_adapter_react.WalletProvider, { wallets, autoConnect: true, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_wallet_adapter_react_ui.WalletModalProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(WalletContent, { onSuccess, type }) }) }) }) });
|
|
4395
|
-
}
|
|
4396
|
-
function SOLModal(props) {
|
|
4397
|
-
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(SOLConnectModal, { ...props });
|
|
4398
|
-
}
|
|
4399
|
-
|
|
4400
|
-
// src/components/TRONModal/index.tsx
|
|
4401
|
-
var import_react32 = __toESM(require("react"));
|
|
4402
|
-
var import_react_intl15 = require("react-intl");
|
|
4403
|
-
|
|
4404
4233
|
// src/lib/tron/TronLinkAdapter.ts
|
|
4405
4234
|
var TronLinkAdapter = class {
|
|
4406
4235
|
constructor() {
|
|
@@ -4432,7 +4261,7 @@ var TronLinkAdapter = class {
|
|
|
4432
4261
|
};
|
|
4433
4262
|
|
|
4434
4263
|
// src/hooks/useTRONWallet.ts
|
|
4435
|
-
var
|
|
4264
|
+
var import_react30 = require("react");
|
|
4436
4265
|
|
|
4437
4266
|
// src/lib/tron/BitgetAdapter.ts
|
|
4438
4267
|
var BitgetAdapter = class {
|
|
@@ -4476,12 +4305,12 @@ var OKXAdapter = class {
|
|
|
4476
4305
|
|
|
4477
4306
|
// src/hooks/useTRONWallet.ts
|
|
4478
4307
|
var useTRONWallet = () => {
|
|
4479
|
-
const
|
|
4480
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
4481
|
-
const [address, setAddress] = (0,
|
|
4482
|
-
(0,
|
|
4308
|
+
const wallets = [new TronLinkAdapter(), new BitgetAdapter(), new OKXAdapter()];
|
|
4309
|
+
const [installedWallets, setInstalledWallets] = (0, import_react30.useState)([]);
|
|
4310
|
+
const [address, setAddress] = (0, import_react30.useState)(null);
|
|
4311
|
+
(0, import_react30.useEffect)(() => {
|
|
4483
4312
|
const getInstalled = async () => {
|
|
4484
|
-
const installed = await Promise.all(
|
|
4313
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
4485
4314
|
wallet: wallet2,
|
|
4486
4315
|
isInstalled
|
|
4487
4316
|
}))));
|
|
@@ -4489,18 +4318,18 @@ var useTRONWallet = () => {
|
|
|
4489
4318
|
};
|
|
4490
4319
|
getInstalled();
|
|
4491
4320
|
}, []);
|
|
4492
|
-
const [wallet, chooseWallet] = (0,
|
|
4321
|
+
const [wallet, chooseWallet] = (0, import_react30.useState)(null);
|
|
4493
4322
|
const onConnect = async () => {
|
|
4494
4323
|
setAddress(await wallet.connect());
|
|
4495
4324
|
};
|
|
4496
|
-
(0,
|
|
4325
|
+
(0, import_react30.useEffect)(() => {
|
|
4497
4326
|
if (!wallet) {
|
|
4498
4327
|
setAddress(null);
|
|
4499
4328
|
}
|
|
4500
4329
|
}, [wallet]);
|
|
4501
4330
|
return {
|
|
4502
4331
|
installedWallets,
|
|
4503
|
-
wallets
|
|
4332
|
+
wallets,
|
|
4504
4333
|
chooseWallet,
|
|
4505
4334
|
wallet,
|
|
4506
4335
|
address,
|
|
@@ -4509,25 +4338,25 @@ var useTRONWallet = () => {
|
|
|
4509
4338
|
};
|
|
4510
4339
|
|
|
4511
4340
|
// src/components/TRONModal/index.tsx
|
|
4512
|
-
var
|
|
4341
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
4513
4342
|
function TRONConnectModal({
|
|
4514
4343
|
type = "login",
|
|
4515
4344
|
onSuccess,
|
|
4516
4345
|
...props
|
|
4517
4346
|
}) {
|
|
4518
4347
|
const isDownMd = useDownMd();
|
|
4519
|
-
const intl = (0,
|
|
4520
|
-
const { wallets
|
|
4348
|
+
const intl = (0, import_react_intl14.useIntl)();
|
|
4349
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useTRONWallet();
|
|
4521
4350
|
const iconMaps = {
|
|
4522
|
-
tronlink: /* @__PURE__ */ (0,
|
|
4523
|
-
bitget: /* @__PURE__ */ (0,
|
|
4524
|
-
okx: /* @__PURE__ */ (0,
|
|
4351
|
+
tronlink: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TronLinkIcon, { size: isDownMd ? 36 : 40 }),
|
|
4352
|
+
bitget: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(BitgetIcon, { size: isDownMd ? 36 : 40 }),
|
|
4353
|
+
okx: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(OKXIcon, { size: isDownMd ? 36 : 40 })
|
|
4525
4354
|
};
|
|
4526
4355
|
const { events, login } = useMatch();
|
|
4527
|
-
const [status, setStatus] = (0,
|
|
4528
|
-
const statusRef =
|
|
4529
|
-
const [error, setError] = (0,
|
|
4530
|
-
const connected = (0,
|
|
4356
|
+
const [status, setStatus] = (0, import_react31.useState)("");
|
|
4357
|
+
const statusRef = import_react31.default.useRef(status);
|
|
4358
|
+
const [error, setError] = (0, import_react31.useState)("");
|
|
4359
|
+
const connected = (0, import_react31.useMemo)(() => {
|
|
4531
4360
|
return !!address;
|
|
4532
4361
|
}, [address]);
|
|
4533
4362
|
const disconnect = async () => {
|
|
@@ -4582,7 +4411,7 @@ function TRONConnectModal({
|
|
|
4582
4411
|
});
|
|
4583
4412
|
} else {
|
|
4584
4413
|
await login({
|
|
4585
|
-
mid: res1.data.mid,
|
|
4414
|
+
// mid: res1.data.mid,
|
|
4586
4415
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4587
4416
|
});
|
|
4588
4417
|
}
|
|
@@ -4595,7 +4424,7 @@ function TRONConnectModal({
|
|
|
4595
4424
|
statusRef.current = "";
|
|
4596
4425
|
}
|
|
4597
4426
|
};
|
|
4598
|
-
(0,
|
|
4427
|
+
(0, import_react31.useEffect)(() => {
|
|
4599
4428
|
if (wallet) {
|
|
4600
4429
|
console.log("onConnect");
|
|
4601
4430
|
onConnect();
|
|
@@ -4603,21 +4432,21 @@ function TRONConnectModal({
|
|
|
4603
4432
|
setStatus("");
|
|
4604
4433
|
}
|
|
4605
4434
|
}, [wallet]);
|
|
4606
|
-
(0,
|
|
4435
|
+
(0, import_react31.useEffect)(() => {
|
|
4607
4436
|
if (address) {
|
|
4608
4437
|
toLoginInWallet();
|
|
4609
4438
|
}
|
|
4610
4439
|
}, [address]);
|
|
4611
|
-
(0,
|
|
4440
|
+
(0, import_react31.useEffect)(() => {
|
|
4612
4441
|
if (!props.isOpen) {
|
|
4613
4442
|
disconnect();
|
|
4614
4443
|
}
|
|
4615
4444
|
}, [props.isOpen]);
|
|
4616
|
-
return /* @__PURE__ */ (0,
|
|
4445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4617
4446
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4618
4447
|
}, {
|
|
4619
4448
|
name: "TRON"
|
|
4620
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
4449
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4621
4450
|
WalletModalContent,
|
|
4622
4451
|
{
|
|
4623
4452
|
error,
|
|
@@ -4630,9 +4459,9 @@ function TRONConnectModal({
|
|
|
4630
4459
|
setVisible: () => {
|
|
4631
4460
|
}
|
|
4632
4461
|
}
|
|
4633
|
-
) : /* @__PURE__ */ (0,
|
|
4462
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "matchid-login-recommend-list", children: [
|
|
4634
4463
|
installedWallets.map((wallet2) => {
|
|
4635
|
-
return /* @__PURE__ */ (0,
|
|
4464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4636
4465
|
RecommendItem,
|
|
4637
4466
|
{
|
|
4638
4467
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -4644,15 +4473,15 @@ function TRONConnectModal({
|
|
|
4644
4473
|
wallet2.walletKey
|
|
4645
4474
|
);
|
|
4646
4475
|
}),
|
|
4647
|
-
|
|
4648
|
-
return /* @__PURE__ */ (0,
|
|
4476
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
4477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4649
4478
|
RecommendItem,
|
|
4650
4479
|
{
|
|
4651
4480
|
icon: iconMaps[wallet2.walletKey],
|
|
4652
4481
|
name: wallet2.name,
|
|
4653
4482
|
onClick: () => {
|
|
4654
4483
|
},
|
|
4655
|
-
footer: /* @__PURE__ */ (0,
|
|
4484
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Button, { size: "sm", onClick: () => {
|
|
4656
4485
|
window.open(wallet2.website);
|
|
4657
4486
|
}, children: "Install" })
|
|
4658
4487
|
},
|
|
@@ -4662,28 +4491,28 @@ function TRONConnectModal({
|
|
|
4662
4491
|
] }) }) });
|
|
4663
4492
|
}
|
|
4664
4493
|
function TRONModal(props) {
|
|
4665
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
4494
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TRONConnectModal, { ...props, type: props.type });
|
|
4666
4495
|
}
|
|
4667
4496
|
|
|
4668
4497
|
// src/components/TONModal/index.tsx
|
|
4669
|
-
var
|
|
4670
|
-
var
|
|
4498
|
+
var import_react32 = __toESM(require("react"));
|
|
4499
|
+
var import_react_intl15 = require("react-intl");
|
|
4671
4500
|
var import_ui_react = require("@tonconnect/ui-react");
|
|
4672
|
-
var
|
|
4673
|
-
function
|
|
4501
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
4502
|
+
function WalletContent({
|
|
4674
4503
|
onSuccess,
|
|
4675
4504
|
type
|
|
4676
4505
|
}) {
|
|
4677
4506
|
const { events, login } = useMatch();
|
|
4678
|
-
const [connected, setConnected] = (0,
|
|
4507
|
+
const [connected, setConnected] = (0, import_react32.useState)(false);
|
|
4679
4508
|
const wallet = (0, import_ui_react.useTonWallet)();
|
|
4680
4509
|
const userFriendlyAddress = (0, import_ui_react.useTonAddress)();
|
|
4681
4510
|
const [tonConnectUI] = (0, import_ui_react.useTonConnectUI)();
|
|
4682
4511
|
const { state, open, close } = (0, import_ui_react.useTonConnectModal)();
|
|
4683
|
-
const [status, setStatus] = (0,
|
|
4684
|
-
const statusRef =
|
|
4685
|
-
const [error, setError] = (0,
|
|
4686
|
-
(0,
|
|
4512
|
+
const [status, setStatus] = (0, import_react32.useState)("");
|
|
4513
|
+
const statusRef = import_react32.default.useRef(status);
|
|
4514
|
+
const [error, setError] = (0, import_react32.useState)("");
|
|
4515
|
+
(0, import_react32.useEffect)(() => {
|
|
4687
4516
|
const init = async () => {
|
|
4688
4517
|
if (tonConnectUI.connected) {
|
|
4689
4518
|
await tonConnectUI.disconnect();
|
|
@@ -4740,7 +4569,7 @@ function WalletContent2({
|
|
|
4740
4569
|
});
|
|
4741
4570
|
} else {
|
|
4742
4571
|
await login({
|
|
4743
|
-
mid: res1.data.mid,
|
|
4572
|
+
// mid: res1.data.mid,
|
|
4744
4573
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
4745
4574
|
});
|
|
4746
4575
|
}
|
|
@@ -4756,7 +4585,7 @@ function WalletContent2({
|
|
|
4756
4585
|
}
|
|
4757
4586
|
});
|
|
4758
4587
|
}, []);
|
|
4759
|
-
(0,
|
|
4588
|
+
(0, import_react32.useEffect)(() => {
|
|
4760
4589
|
if (wallet) {
|
|
4761
4590
|
setConnected(true);
|
|
4762
4591
|
console.log("Wallet connected:", wallet);
|
|
@@ -4767,7 +4596,7 @@ function WalletContent2({
|
|
|
4767
4596
|
setStatus("");
|
|
4768
4597
|
}
|
|
4769
4598
|
}, [wallet]);
|
|
4770
|
-
(0,
|
|
4599
|
+
(0, import_react32.useEffect)(() => {
|
|
4771
4600
|
console.log({
|
|
4772
4601
|
state,
|
|
4773
4602
|
wallet
|
|
@@ -4796,7 +4625,7 @@ function WalletContent2({
|
|
|
4796
4625
|
}
|
|
4797
4626
|
}
|
|
4798
4627
|
}, [state]);
|
|
4799
|
-
return /* @__PURE__ */ (0,
|
|
4628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4800
4629
|
WalletModalContent,
|
|
4801
4630
|
{
|
|
4802
4631
|
connected,
|
|
@@ -4827,28 +4656,28 @@ function TONConnectModal({
|
|
|
4827
4656
|
onSuccess,
|
|
4828
4657
|
...props
|
|
4829
4658
|
}) {
|
|
4830
|
-
const intl = (0,
|
|
4659
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
4831
4660
|
const { endpoints, appid } = useLocalStore_default();
|
|
4832
4661
|
const manifestUrl = `${endpoints.back}api/v1/wallet/ton?appid=${appid}&url=` + encodeURIComponent(window.location.origin);
|
|
4833
|
-
return /* @__PURE__ */ (0,
|
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
4834
4663
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
4835
4664
|
}, {
|
|
4836
4665
|
name: "TON"
|
|
4837
|
-
}), children: /* @__PURE__ */ (0,
|
|
4666
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4838
4667
|
import_ui_react.TonConnectUIProvider,
|
|
4839
4668
|
{
|
|
4840
4669
|
manifestUrl,
|
|
4841
|
-
children: /* @__PURE__ */ (0,
|
|
4670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(WalletContent, { onSuccess, type })
|
|
4842
4671
|
}
|
|
4843
4672
|
) });
|
|
4844
4673
|
}
|
|
4845
4674
|
function TONModal(props) {
|
|
4846
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
4675
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TONConnectModal, { ...props });
|
|
4847
4676
|
}
|
|
4848
4677
|
|
|
4849
4678
|
// src/components/BTCModal/index.tsx
|
|
4850
|
-
var
|
|
4851
|
-
var
|
|
4679
|
+
var import_react34 = __toESM(require("react"));
|
|
4680
|
+
var import_react_intl16 = require("react-intl");
|
|
4852
4681
|
|
|
4853
4682
|
// src/lib/btc/UnisatAdapter.ts
|
|
4854
4683
|
var UnisatAdapter = class {
|
|
@@ -4996,14 +4825,14 @@ var LeatherAdapter = class {
|
|
|
4996
4825
|
};
|
|
4997
4826
|
|
|
4998
4827
|
// src/hooks/useBTCWallet.ts
|
|
4999
|
-
var
|
|
4828
|
+
var import_react33 = require("react");
|
|
5000
4829
|
var useBTCWallet = () => {
|
|
5001
|
-
const
|
|
5002
|
-
const [installedWallets, setInstalledWallets] = (0,
|
|
5003
|
-
const [address, setAddress] = (0,
|
|
5004
|
-
(0,
|
|
4830
|
+
const wallets = [new UnisatAdapter(), new XverseAdapter(), new LeatherAdapter()];
|
|
4831
|
+
const [installedWallets, setInstalledWallets] = (0, import_react33.useState)([]);
|
|
4832
|
+
const [address, setAddress] = (0, import_react33.useState)(null);
|
|
4833
|
+
(0, import_react33.useEffect)(() => {
|
|
5005
4834
|
const getInstalled = async () => {
|
|
5006
|
-
const installed = await Promise.all(
|
|
4835
|
+
const installed = await Promise.all(wallets.map((wallet2) => wallet2.isInstalled().then((isInstalled) => ({
|
|
5007
4836
|
wallet: wallet2,
|
|
5008
4837
|
isInstalled
|
|
5009
4838
|
}))));
|
|
@@ -5011,18 +4840,18 @@ var useBTCWallet = () => {
|
|
|
5011
4840
|
};
|
|
5012
4841
|
getInstalled();
|
|
5013
4842
|
}, []);
|
|
5014
|
-
const [wallet, chooseWallet] = (0,
|
|
4843
|
+
const [wallet, chooseWallet] = (0, import_react33.useState)(null);
|
|
5015
4844
|
const onConnect = async () => {
|
|
5016
4845
|
setAddress(await wallet.connect());
|
|
5017
4846
|
};
|
|
5018
|
-
(0,
|
|
4847
|
+
(0, import_react33.useEffect)(() => {
|
|
5019
4848
|
if (!wallet) {
|
|
5020
4849
|
setAddress(null);
|
|
5021
4850
|
}
|
|
5022
4851
|
}, [wallet]);
|
|
5023
4852
|
return {
|
|
5024
4853
|
installedWallets,
|
|
5025
|
-
wallets
|
|
4854
|
+
wallets,
|
|
5026
4855
|
chooseWallet,
|
|
5027
4856
|
wallet,
|
|
5028
4857
|
address,
|
|
@@ -5031,25 +4860,25 @@ var useBTCWallet = () => {
|
|
|
5031
4860
|
};
|
|
5032
4861
|
|
|
5033
4862
|
// src/components/BTCModal/index.tsx
|
|
5034
|
-
var
|
|
4863
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
5035
4864
|
function BTCConnectModal({
|
|
5036
4865
|
type = "login",
|
|
5037
4866
|
onSuccess,
|
|
5038
4867
|
...props
|
|
5039
4868
|
}) {
|
|
5040
4869
|
const isDownMd = useDownMd();
|
|
5041
|
-
const intl = (0,
|
|
5042
|
-
const { wallets
|
|
4870
|
+
const intl = (0, import_react_intl16.useIntl)();
|
|
4871
|
+
const { wallets, installedWallets, chooseWallet, wallet, address, onConnect } = useBTCWallet();
|
|
5043
4872
|
const iconMaps = {
|
|
5044
|
-
leather: /* @__PURE__ */ (0,
|
|
5045
|
-
unisat: /* @__PURE__ */ (0,
|
|
5046
|
-
xverse: /* @__PURE__ */ (0,
|
|
4873
|
+
leather: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(LeatherIcon, { size: isDownMd ? 36 : 40 }),
|
|
4874
|
+
unisat: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(UnisatIcon, { size: isDownMd ? 36 : 40 }),
|
|
4875
|
+
xverse: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(XverseIcon, { size: isDownMd ? 36 : 40 })
|
|
5047
4876
|
};
|
|
5048
4877
|
const { events, login } = useMatch();
|
|
5049
|
-
const [status, setStatus] = (0,
|
|
5050
|
-
const statusRef =
|
|
5051
|
-
const [error, setError] = (0,
|
|
5052
|
-
const connected = (0,
|
|
4878
|
+
const [status, setStatus] = (0, import_react34.useState)("");
|
|
4879
|
+
const statusRef = import_react34.default.useRef(status);
|
|
4880
|
+
const [error, setError] = (0, import_react34.useState)("");
|
|
4881
|
+
const connected = (0, import_react34.useMemo)(() => {
|
|
5053
4882
|
return !!address;
|
|
5054
4883
|
}, [address]);
|
|
5055
4884
|
const disconnect = async () => {
|
|
@@ -5099,7 +4928,7 @@ function BTCConnectModal({
|
|
|
5099
4928
|
});
|
|
5100
4929
|
} else {
|
|
5101
4930
|
await login({
|
|
5102
|
-
mid: res1.data.mid,
|
|
4931
|
+
// mid: res1.data.mid,
|
|
5103
4932
|
token: `${res1.data.token_type} ${res1.data.access_token}`
|
|
5104
4933
|
});
|
|
5105
4934
|
}
|
|
@@ -5113,7 +4942,7 @@ function BTCConnectModal({
|
|
|
5113
4942
|
statusRef.current = "";
|
|
5114
4943
|
}
|
|
5115
4944
|
};
|
|
5116
|
-
(0,
|
|
4945
|
+
(0, import_react34.useEffect)(() => {
|
|
5117
4946
|
if (wallet) {
|
|
5118
4947
|
console.log("onConnect");
|
|
5119
4948
|
try {
|
|
@@ -5126,12 +4955,12 @@ function BTCConnectModal({
|
|
|
5126
4955
|
setStatus("");
|
|
5127
4956
|
}
|
|
5128
4957
|
}, [wallet]);
|
|
5129
|
-
(0,
|
|
4958
|
+
(0, import_react34.useEffect)(() => {
|
|
5130
4959
|
if (address) {
|
|
5131
4960
|
toLoginInWallet();
|
|
5132
4961
|
}
|
|
5133
4962
|
}, [address]);
|
|
5134
|
-
(0,
|
|
4963
|
+
(0, import_react34.useEffect)(() => {
|
|
5135
4964
|
if (!props.isOpen) {
|
|
5136
4965
|
disconnect();
|
|
5137
4966
|
}
|
|
@@ -5143,11 +4972,11 @@ function BTCConnectModal({
|
|
|
5143
4972
|
statusRef.current = "";
|
|
5144
4973
|
setError("");
|
|
5145
4974
|
};
|
|
5146
|
-
return /* @__PURE__ */ (0,
|
|
4975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5147
4976
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5148
4977
|
}, {
|
|
5149
4978
|
name: "BTC"
|
|
5150
|
-
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0,
|
|
4979
|
+
}), onBack: wallet ? onBack : void 0, children: wallet ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5151
4980
|
WalletModalContent,
|
|
5152
4981
|
{
|
|
5153
4982
|
error,
|
|
@@ -5160,9 +4989,9 @@ function BTCConnectModal({
|
|
|
5160
4989
|
setVisible: () => {
|
|
5161
4990
|
}
|
|
5162
4991
|
}
|
|
5163
|
-
) : /* @__PURE__ */ (0,
|
|
4992
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "matchid-login-recommend-list", children: [
|
|
5164
4993
|
installedWallets.map((wallet2) => {
|
|
5165
|
-
return /* @__PURE__ */ (0,
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5166
4995
|
RecommendItem,
|
|
5167
4996
|
{
|
|
5168
4997
|
icon: iconMaps[wallet2.walletKey],
|
|
@@ -5174,15 +5003,15 @@ function BTCConnectModal({
|
|
|
5174
5003
|
wallet2.walletKey
|
|
5175
5004
|
);
|
|
5176
5005
|
}),
|
|
5177
|
-
|
|
5178
|
-
return /* @__PURE__ */ (0,
|
|
5006
|
+
wallets.filter((wallet2) => !installedWallets.find((installedWallet) => installedWallet.walletKey == wallet2.walletKey)).map((wallet2) => {
|
|
5007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
5179
5008
|
RecommendItem,
|
|
5180
5009
|
{
|
|
5181
5010
|
icon: iconMaps[wallet2.walletKey],
|
|
5182
5011
|
name: wallet2.name,
|
|
5183
5012
|
onClick: () => {
|
|
5184
5013
|
},
|
|
5185
|
-
footer: /* @__PURE__ */ (0,
|
|
5014
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Button, { size: "sm", onClick: () => {
|
|
5186
5015
|
window.open(wallet2.website);
|
|
5187
5016
|
}, children: "Install" })
|
|
5188
5017
|
},
|
|
@@ -5192,23 +5021,23 @@ function BTCConnectModal({
|
|
|
5192
5021
|
] }) }) });
|
|
5193
5022
|
}
|
|
5194
5023
|
function BTCModal(props) {
|
|
5195
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5024
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(BTCConnectModal, { ...props });
|
|
5196
5025
|
}
|
|
5197
5026
|
|
|
5198
5027
|
// src/components/WalletModal/index.tsx
|
|
5199
|
-
var
|
|
5200
|
-
var
|
|
5201
|
-
var
|
|
5028
|
+
var import_react35 = require("react");
|
|
5029
|
+
var import_react_intl17 = require("react-intl");
|
|
5030
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
5202
5031
|
function WalletConnectModal({
|
|
5203
5032
|
type,
|
|
5204
5033
|
methods: _methods,
|
|
5205
5034
|
...props
|
|
5206
5035
|
}) {
|
|
5207
|
-
const intl = (0,
|
|
5036
|
+
const intl = (0, import_react_intl17.useIntl)();
|
|
5208
5037
|
const { walletMap } = useWalletConfig();
|
|
5209
5038
|
const { bind, login } = useUserInfo();
|
|
5210
5039
|
const config = useAppConfig();
|
|
5211
|
-
const methods = (0,
|
|
5040
|
+
const methods = (0, import_react35.useMemo)(() => {
|
|
5212
5041
|
if (_methods) return _methods;
|
|
5213
5042
|
if (!config.platform) {
|
|
5214
5043
|
return [];
|
|
@@ -5216,13 +5045,13 @@ function WalletConnectModal({
|
|
|
5216
5045
|
const platform = config.platform.map((p) => p.toLowerCase());
|
|
5217
5046
|
return WALLET_METHODS.filter((m) => platform.includes(m));
|
|
5218
5047
|
}, [config.platform, _methods]);
|
|
5219
|
-
return /* @__PURE__ */ (0,
|
|
5048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ModalWithHeader, { ...props, title: props.title || intl.formatMessage({
|
|
5220
5049
|
id: type == "bind" ? "bindWith" : "loginWith"
|
|
5221
5050
|
}, {
|
|
5222
5051
|
name: ""
|
|
5223
|
-
}), children: /* @__PURE__ */ (0,
|
|
5052
|
+
}), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-login-box", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "matchid-login-recommend-list", children: methods.map((method, index) => {
|
|
5224
5053
|
const m = walletMap[method];
|
|
5225
|
-
return /* @__PURE__ */ (0,
|
|
5054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5226
5055
|
RecommendItem,
|
|
5227
5056
|
{
|
|
5228
5057
|
icon: m?.icon,
|
|
@@ -5236,21 +5065,21 @@ function WalletConnectModal({
|
|
|
5236
5065
|
}) }) }) });
|
|
5237
5066
|
}
|
|
5238
5067
|
function WalletModal(props) {
|
|
5239
|
-
return props.isOpen && /* @__PURE__ */ (0,
|
|
5068
|
+
return props.isOpen && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(WalletConnectModal, { ...props });
|
|
5240
5069
|
}
|
|
5241
5070
|
|
|
5242
5071
|
// src/components/AlphaAvatar/index.tsx
|
|
5243
|
-
var
|
|
5244
|
-
var
|
|
5072
|
+
var import_react36 = require("react");
|
|
5073
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5245
5074
|
function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
5246
|
-
const [avatar, setAvatar] = (0,
|
|
5247
|
-
(0,
|
|
5075
|
+
const [avatar, setAvatar] = (0, import_react36.useState)(void 0);
|
|
5076
|
+
(0, import_react36.useEffect)(() => {
|
|
5248
5077
|
if (name) {
|
|
5249
5078
|
const char = name[0].toUpperCase();
|
|
5250
5079
|
setAvatar(char);
|
|
5251
5080
|
}
|
|
5252
5081
|
}, [name]);
|
|
5253
|
-
return /* @__PURE__ */ (0,
|
|
5082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `matchid-alpha-avatar ${className}`, style: {
|
|
5254
5083
|
width: size,
|
|
5255
5084
|
height: size,
|
|
5256
5085
|
fontSize: Math.ceil(size / 2)
|
|
@@ -5258,7 +5087,7 @@ function AlphaAvatar2({ name, size = 40, className = "" }) {
|
|
|
5258
5087
|
}
|
|
5259
5088
|
|
|
5260
5089
|
// src/components/WalletAsset/index.tsx
|
|
5261
|
-
var
|
|
5090
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
5262
5091
|
function WalletAsset({
|
|
5263
5092
|
onAssetClick,
|
|
5264
5093
|
matchWalletAssetsOptions
|
|
@@ -5268,7 +5097,7 @@ function WalletAsset({
|
|
|
5268
5097
|
list: walletAssets.mergedAssets
|
|
5269
5098
|
});
|
|
5270
5099
|
const { list } = useMatchChain();
|
|
5271
|
-
return /* @__PURE__ */ (0,
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "matchid-wallet-asset-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5272
5101
|
const clickFunc = onAssetClick && onAssetClick(n);
|
|
5273
5102
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5274
5103
|
const getFooterColor = () => {
|
|
@@ -5283,11 +5112,11 @@ function WalletAsset({
|
|
|
5283
5112
|
}
|
|
5284
5113
|
return "";
|
|
5285
5114
|
};
|
|
5286
|
-
return /* @__PURE__ */ (0,
|
|
5115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-wallet-asset-item`, onClick: clickFunc, style: {
|
|
5287
5116
|
cursor: clickFunc ? "pointer" : "default"
|
|
5288
5117
|
}, children: [
|
|
5289
|
-
/* @__PURE__ */ (0,
|
|
5290
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "matchid-wallet-asset-logo", title: n.symbol || n.name || "", children: [
|
|
5119
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-wallet-asset-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5291
5120
|
AlphaAvatar2,
|
|
5292
5121
|
{
|
|
5293
5122
|
className: `matchid-wallet-asset-icon`,
|
|
@@ -5295,12 +5124,12 @@ function WalletAsset({
|
|
|
5295
5124
|
name: n.symbol || n.name || ""
|
|
5296
5125
|
}
|
|
5297
5126
|
),
|
|
5298
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5127
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-wallet-asset-chain` })
|
|
5299
5128
|
] }),
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5301
|
-
/* @__PURE__ */ (0,
|
|
5302
|
-
"price" in n && /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5129
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-wallet-asset-info`, children: [
|
|
5130
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-wallet-asset-name`, children: n.symbol }),
|
|
5131
|
+
"price" in n && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-wallet-asset-content`, children: [
|
|
5132
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "matchid-wallet-asset-price", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5304
5133
|
NumberFormatter,
|
|
5305
5134
|
{
|
|
5306
5135
|
value: n.price,
|
|
@@ -5308,7 +5137,7 @@ function WalletAsset({
|
|
|
5308
5137
|
tFixNum: 2
|
|
5309
5138
|
}
|
|
5310
5139
|
) }),
|
|
5311
|
-
/* @__PURE__ */ (0,
|
|
5140
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "matchid-wallet-asset-value", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5312
5141
|
NumberFormatter,
|
|
5313
5142
|
{
|
|
5314
5143
|
value: n.value,
|
|
@@ -5317,15 +5146,15 @@ function WalletAsset({
|
|
|
5317
5146
|
}
|
|
5318
5147
|
) })
|
|
5319
5148
|
] }),
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
/* @__PURE__ */ (0,
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `matchid-wallet-asset-footer`, children: [
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-wallet-asset-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5322
5151
|
NumberFormatter,
|
|
5323
5152
|
{
|
|
5324
5153
|
value: n.balance,
|
|
5325
5154
|
tFixNum: 3
|
|
5326
5155
|
}
|
|
5327
5156
|
) }),
|
|
5328
|
-
"price_change_24h" in n && /* @__PURE__ */ (0,
|
|
5157
|
+
"price_change_24h" in n && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: `matchid-wallet-asset-change ${getFooterColor()}`, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
5329
5158
|
NumberFormatter,
|
|
5330
5159
|
{
|
|
5331
5160
|
prefix: `${(n?.price_change_24h || 0) < 0 ? "-" : "+"} `,
|
|
@@ -5341,10 +5170,10 @@ function WalletAsset({
|
|
|
5341
5170
|
}
|
|
5342
5171
|
|
|
5343
5172
|
// src/components/TokenSend/index.tsx
|
|
5344
|
-
var
|
|
5173
|
+
var import_react37 = require("react");
|
|
5345
5174
|
var import_viem11 = require("viem");
|
|
5346
|
-
var
|
|
5347
|
-
var
|
|
5175
|
+
var import_react_intl18 = require("react-intl");
|
|
5176
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
5348
5177
|
function Input2({
|
|
5349
5178
|
onChange,
|
|
5350
5179
|
placeholder,
|
|
@@ -5354,8 +5183,8 @@ function Input2({
|
|
|
5354
5183
|
error,
|
|
5355
5184
|
size = "df"
|
|
5356
5185
|
}) {
|
|
5357
|
-
return /* @__PURE__ */ (0,
|
|
5358
|
-
/* @__PURE__ */ (0,
|
|
5186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-input-box ${"matchid-token-input-" + size}`, children: [
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5359
5188
|
"input",
|
|
5360
5189
|
{
|
|
5361
5190
|
placeholder,
|
|
@@ -5366,7 +5195,7 @@ function Input2({
|
|
|
5366
5195
|
className: `matchid-token-input ${error ? "matchid-token-input-error" : ""}`
|
|
5367
5196
|
}
|
|
5368
5197
|
),
|
|
5369
|
-
error && /* @__PURE__ */ (0,
|
|
5198
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "matchid-token-input-error-text", children: error })
|
|
5370
5199
|
] });
|
|
5371
5200
|
}
|
|
5372
5201
|
function TokenSend({
|
|
@@ -5376,25 +5205,25 @@ function TokenSend({
|
|
|
5376
5205
|
onBack
|
|
5377
5206
|
}) {
|
|
5378
5207
|
const { list: chainList } = useMatchChain();
|
|
5379
|
-
const intl = (0,
|
|
5208
|
+
const intl = (0, import_react_intl18.useIntl)();
|
|
5380
5209
|
const { createWalletClient: createWalletClient2 } = useWallet();
|
|
5381
5210
|
const isNative = token.address.toLowerCase() == NATIVE_TOKEN_ADDRESS;
|
|
5382
|
-
const chain = (0,
|
|
5211
|
+
const chain = (0, import_react37.useMemo)(() => {
|
|
5383
5212
|
return chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5384
5213
|
}, [chainList, token.chain_id]);
|
|
5385
|
-
const walletClient = (0,
|
|
5214
|
+
const walletClient = (0, import_react37.useMemo)(() => {
|
|
5386
5215
|
return createWalletClient2({
|
|
5387
5216
|
// @ts-ignore
|
|
5388
5217
|
chain: (0, import_viem11.defineChain)(chain),
|
|
5389
5218
|
transport: (0, import_viem11.http)()
|
|
5390
5219
|
});
|
|
5391
5220
|
}, [chain]);
|
|
5392
|
-
const [amount, setAmount] = (0,
|
|
5393
|
-
const [address, setAddress] = (0,
|
|
5394
|
-
const [loading, setLoading] = (0,
|
|
5395
|
-
const [sending, setSending] = (0,
|
|
5396
|
-
const [txError, setTxError] = (0,
|
|
5397
|
-
const transaction = (0,
|
|
5221
|
+
const [amount, setAmount] = (0, import_react37.useState)("");
|
|
5222
|
+
const [address, setAddress] = (0, import_react37.useState)("");
|
|
5223
|
+
const [loading, setLoading] = (0, import_react37.useState)(false);
|
|
5224
|
+
const [sending, setSending] = (0, import_react37.useState)(false);
|
|
5225
|
+
const [txError, setTxError] = (0, import_react37.useState)("");
|
|
5226
|
+
const transaction = (0, import_react37.useMemo)(() => {
|
|
5398
5227
|
const reg = /^0x[a-fA-F0-9]{40}$/;
|
|
5399
5228
|
if (!amount || !address || !reg.test(address)) {
|
|
5400
5229
|
return;
|
|
@@ -5425,7 +5254,7 @@ function TokenSend({
|
|
|
5425
5254
|
setLoading(false);
|
|
5426
5255
|
}
|
|
5427
5256
|
};
|
|
5428
|
-
const error = (0,
|
|
5257
|
+
const error = (0, import_react37.useMemo)(() => {
|
|
5429
5258
|
setTxError("");
|
|
5430
5259
|
let amountError = "";
|
|
5431
5260
|
let addressError = "";
|
|
@@ -5468,7 +5297,7 @@ function TokenSend({
|
|
|
5468
5297
|
setAmount(value);
|
|
5469
5298
|
}
|
|
5470
5299
|
};
|
|
5471
|
-
const canSend = (0,
|
|
5300
|
+
const canSend = (0, import_react37.useMemo)(() => {
|
|
5472
5301
|
return !error.amount && !error.address && amount && address;
|
|
5473
5302
|
}, [error]);
|
|
5474
5303
|
const onNext = async () => {
|
|
@@ -5478,7 +5307,7 @@ function TokenSend({
|
|
|
5478
5307
|
}
|
|
5479
5308
|
onClose();
|
|
5480
5309
|
};
|
|
5481
|
-
(0,
|
|
5310
|
+
(0, import_react37.useEffect)(() => {
|
|
5482
5311
|
const receiveMessage = (event) => {
|
|
5483
5312
|
if (event.data) {
|
|
5484
5313
|
if (event.data.source == "match-wallet") {
|
|
@@ -5494,24 +5323,24 @@ function TokenSend({
|
|
|
5494
5323
|
window.removeEventListener("message", receiveMessage);
|
|
5495
5324
|
};
|
|
5496
5325
|
}, []);
|
|
5497
|
-
return /* @__PURE__ */ (0,
|
|
5498
|
-
/* @__PURE__ */ (0,
|
|
5499
|
-
/* @__PURE__ */ (0,
|
|
5500
|
-
/* @__PURE__ */ (0,
|
|
5501
|
-
/* @__PURE__ */ (0,
|
|
5502
|
-
/* @__PURE__ */ (0,
|
|
5503
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ModalDrawer, { isOpen: true, onClose, zIndex, title: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl18.FormattedMessage, { id: "send" }), onBack, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-send-box`, children: [
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-amount-content`, children: [
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-amount-header`, children: [
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: `matchid-token-amount-title`, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl18.FormattedMessage, { id: "amount" }) }),
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-amount-chain`, children: [
|
|
5332
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5504
5333
|
"img",
|
|
5505
5334
|
{
|
|
5506
5335
|
src: token?.icon,
|
|
5507
5336
|
alt: token?.symbol,
|
|
5508
5337
|
className: `matchid-token-amount-chain-icon`
|
|
5509
5338
|
}
|
|
5510
|
-
) : /* @__PURE__ */ (0,
|
|
5511
|
-
/* @__PURE__ */ (0,
|
|
5339
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(AlphaAvatar, { name: token.symbol || token.name || "", size: 16 }),
|
|
5340
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { children: token?.symbol })
|
|
5512
5341
|
] })
|
|
5513
5342
|
] }),
|
|
5514
|
-
/* @__PURE__ */ (0,
|
|
5343
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5515
5344
|
Input2,
|
|
5516
5345
|
{
|
|
5517
5346
|
type: "text",
|
|
@@ -5524,18 +5353,18 @@ function TokenSend({
|
|
|
5524
5353
|
error: error.amount || txError
|
|
5525
5354
|
}
|
|
5526
5355
|
),
|
|
5527
|
-
/* @__PURE__ */ (0,
|
|
5528
|
-
/* @__PURE__ */ (0,
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-amount-footer`, children: [
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-amount-title`, children: [
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl18.FormattedMessage, { id: "balance" }),
|
|
5530
5359
|
":"
|
|
5531
5360
|
] }),
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: `matchid-token-amount-value`, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10, suffix: " " + token.symbol }) })
|
|
5533
5362
|
] }),
|
|
5534
|
-
/* @__PURE__ */ (0,
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TransferIcon, { className: "matchid-token-amount-transfer" })
|
|
5535
5364
|
] }),
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `matchid-token-address-content`, children: [
|
|
5366
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: `matchid-token-address-header`, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: `matchid-token-address-title`, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl18.FormattedMessage, { id: "receiveTitle" }) }) }),
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5539
5368
|
Input2,
|
|
5540
5369
|
{
|
|
5541
5370
|
type: "text",
|
|
@@ -5551,7 +5380,7 @@ function TokenSend({
|
|
|
5551
5380
|
)
|
|
5552
5381
|
] })
|
|
5553
5382
|
] }),
|
|
5554
|
-
/* @__PURE__ */ (0,
|
|
5383
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
5555
5384
|
Button,
|
|
5556
5385
|
{
|
|
5557
5386
|
size: "lg",
|
|
@@ -5560,15 +5389,15 @@ function TokenSend({
|
|
|
5560
5389
|
disabled: !canSend || !!txError,
|
|
5561
5390
|
onClick: onNext,
|
|
5562
5391
|
loading: loading || sending,
|
|
5563
|
-
children: /* @__PURE__ */ (0,
|
|
5392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_intl18.FormattedMessage, { id: "next" })
|
|
5564
5393
|
}
|
|
5565
5394
|
)
|
|
5566
5395
|
] }) });
|
|
5567
5396
|
}
|
|
5568
5397
|
|
|
5569
5398
|
// src/components/TokenDetail/index.tsx
|
|
5570
|
-
var
|
|
5571
|
-
var
|
|
5399
|
+
var import_react_intl19 = require("react-intl");
|
|
5400
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
5572
5401
|
function TokenDetail({
|
|
5573
5402
|
onClose,
|
|
5574
5403
|
token
|
|
@@ -5578,41 +5407,41 @@ function TokenDetail({
|
|
|
5578
5407
|
const chain = chainList?.find((m) => m.id.toString() === token.chain_id);
|
|
5579
5408
|
const onSend = () => {
|
|
5580
5409
|
modal.show((props) => {
|
|
5581
|
-
return /* @__PURE__ */ (0,
|
|
5410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TokenSend, { onClose: () => {
|
|
5582
5411
|
props.close();
|
|
5583
5412
|
onClose();
|
|
5584
5413
|
}, onBack: props.close, zIndex: props.zIndex, token });
|
|
5585
5414
|
});
|
|
5586
5415
|
};
|
|
5587
|
-
const intl = (0,
|
|
5588
|
-
return /* @__PURE__ */ (0,
|
|
5416
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
5417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ModalDrawer, { isOpen: true, title: intl.formatMessage({
|
|
5589
5418
|
id: "tokenDetails"
|
|
5590
|
-
}), onClose, children: /* @__PURE__ */ (0,
|
|
5591
|
-
/* @__PURE__ */ (0,
|
|
5592
|
-
/* @__PURE__ */ (0,
|
|
5593
|
-
/* @__PURE__ */ (0,
|
|
5594
|
-
token.icon ? /* @__PURE__ */ (0,
|
|
5595
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5419
|
+
}), onClose, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-detail`, children: [
|
|
5420
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-main`, children: [
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-info`, children: [
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-logo`, children: [
|
|
5423
|
+
token.icon ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("img", { src: token.icon, alt: token.symbol, className: `matchid-token-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(AlphaAvatar, { className: `matchid-token-icon`, size: 48, name: token.symbol || token.name || "" }),
|
|
5424
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("img", { src: chain.iconUrl, alt: chain.name, className: `matchid-token-chain` })
|
|
5596
5425
|
] }),
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5426
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-name`, children: [
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(NumberFormatter, { value: token.balance, tFixNum: 10 }),
|
|
5599
5428
|
" ",
|
|
5600
5429
|
token.symbol
|
|
5601
5430
|
] })
|
|
5602
5431
|
] }),
|
|
5603
|
-
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0,
|
|
5604
|
-
/* @__PURE__ */ (0,
|
|
5605
|
-
/* @__PURE__ */ (0,
|
|
5432
|
+
token.address.toLowerCase() != NATIVE_TOKEN_ADDRESS && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: `matchid-token-contract`, children: [
|
|
5433
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "matchid-token-contract-title", children: "Contract address" }),
|
|
5434
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "matchid-token-contract-address", children: token.address })
|
|
5606
5435
|
] })
|
|
5607
5436
|
] }),
|
|
5608
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button, { size: "lg", block: true, highlight: true, onClick: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react_intl19.FormattedMessage, { id: "send" }) })
|
|
5609
5438
|
] }) });
|
|
5610
5439
|
}
|
|
5611
5440
|
|
|
5612
5441
|
// src/components/TokenSendList/index.tsx
|
|
5613
|
-
var
|
|
5614
|
-
var
|
|
5615
|
-
var
|
|
5442
|
+
var import_react38 = require("react");
|
|
5443
|
+
var import_react_intl20 = require("react-intl");
|
|
5444
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
5616
5445
|
function TokenSendList({ close }) {
|
|
5617
5446
|
const isDownMd = useDownMd();
|
|
5618
5447
|
const walletAssets = useMatchWalletAssets();
|
|
@@ -5620,20 +5449,20 @@ function TokenSendList({ close }) {
|
|
|
5620
5449
|
list: walletAssets.mergedAssets
|
|
5621
5450
|
});
|
|
5622
5451
|
const { list } = useMatchChain();
|
|
5623
|
-
const [checked, setChecked] = (0,
|
|
5452
|
+
const [checked, setChecked] = (0, import_react38.useState)();
|
|
5624
5453
|
const modal = useModal();
|
|
5625
5454
|
const onNext = () => {
|
|
5626
5455
|
checked && modal.show((props) => {
|
|
5627
|
-
return /* @__PURE__ */ (0,
|
|
5456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TokenSend, { onClose: () => {
|
|
5628
5457
|
props.close();
|
|
5629
5458
|
close();
|
|
5630
5459
|
}, onBack: props.close, zIndex: props.zIndex, token: checked });
|
|
5631
5460
|
});
|
|
5632
5461
|
};
|
|
5633
|
-
return /* @__PURE__ */ (0,
|
|
5634
|
-
/* @__PURE__ */ (0,
|
|
5462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-token-send-list-box", children: [
|
|
5463
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "matchid-token-send-list", children: matchWalletAssetList.list.map((n, index) => {
|
|
5635
5464
|
const chain = list?.find((m) => m.id.toString() === n.chain_id);
|
|
5636
|
-
return /* @__PURE__ */ (0,
|
|
5465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
5637
5466
|
"div",
|
|
5638
5467
|
{
|
|
5639
5468
|
className: `matchid-token-send-item ${checked?.address == n.address ? "matchid-token-send-chekced" : ""}`,
|
|
@@ -5641,10 +5470,10 @@ function TokenSendList({ close }) {
|
|
|
5641
5470
|
setChecked(n);
|
|
5642
5471
|
},
|
|
5643
5472
|
children: [
|
|
5644
|
-
/* @__PURE__ */ (0,
|
|
5645
|
-
/* @__PURE__ */ (0,
|
|
5646
|
-
/* @__PURE__ */ (0,
|
|
5647
|
-
n.icon ? /* @__PURE__ */ (0,
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Radio, { checked: checked?.address == n.address, size: isDownMd ? 18 : 24 }),
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-token-send-content", children: [
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "matchid-token-send-logo", children: [
|
|
5476
|
+
n.icon ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("img", { src: n.icon, alt: n.symbol, className: `matchid-token-send-icon` }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5648
5477
|
AlphaAvatar2,
|
|
5649
5478
|
{
|
|
5650
5479
|
className: `matchid-token-send-icon`,
|
|
@@ -5652,7 +5481,7 @@ function TokenSendList({ close }) {
|
|
|
5652
5481
|
name: n.symbol || n.name || ""
|
|
5653
5482
|
}
|
|
5654
5483
|
),
|
|
5655
|
-
chain?.iconUrl && /* @__PURE__ */ (0,
|
|
5484
|
+
chain?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5656
5485
|
"img",
|
|
5657
5486
|
{
|
|
5658
5487
|
src: chain.iconUrl,
|
|
@@ -5661,9 +5490,9 @@ function TokenSendList({ close }) {
|
|
|
5661
5490
|
}
|
|
5662
5491
|
)
|
|
5663
5492
|
] }),
|
|
5664
|
-
/* @__PURE__ */ (0,
|
|
5665
|
-
/* @__PURE__ */ (0,
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: `matchid-token-send-info`, children: [
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: `matchid-token-send-name`, children: n.symbol }),
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: `matchid-token-send-balance`, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(NumberFormatter, { value: n.balance, tFixNum: 3 }) })
|
|
5667
5496
|
] })
|
|
5668
5497
|
] })
|
|
5669
5498
|
]
|
|
@@ -5671,24 +5500,24 @@ function TokenSendList({ close }) {
|
|
|
5671
5500
|
index
|
|
5672
5501
|
);
|
|
5673
5502
|
}) }),
|
|
5674
|
-
/* @__PURE__ */ (0,
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Button, { size: "lg", highlight: true, block: true, disabled: !checked, onClick: onNext, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react_intl20.FormattedMessage, { id: "next" }) })
|
|
5675
5504
|
] });
|
|
5676
5505
|
}
|
|
5677
5506
|
|
|
5678
5507
|
// src/components/TransactionList/index.tsx
|
|
5679
5508
|
var import_react_infinite_scroll_component = __toESM(require("react-infinite-scroll-component"));
|
|
5680
|
-
var
|
|
5509
|
+
var import_react39 = require("react");
|
|
5681
5510
|
var import_viem12 = require("viem");
|
|
5682
5511
|
var import_viem13 = require("viem");
|
|
5683
|
-
var
|
|
5684
|
-
var
|
|
5512
|
+
var import_react_intl21 = require("react-intl");
|
|
5513
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
5685
5514
|
var Item = ({ data }) => {
|
|
5686
5515
|
const { address } = useWallet();
|
|
5687
5516
|
const isOut = data.from.toLowerCase() == address.toLowerCase();
|
|
5688
5517
|
const { chain, chainId, explorerLink, formatUnits: chainFormatUnits } = useMatchChain();
|
|
5689
5518
|
const { contracts } = useContractStore_default();
|
|
5690
|
-
const [shouldRefetch, setShouldRefetch] = (0,
|
|
5691
|
-
const transferType = (0,
|
|
5519
|
+
const [shouldRefetch, setShouldRefetch] = (0, import_react39.useState)(true);
|
|
5520
|
+
const transferType = (0, import_react39.useMemo)(() => {
|
|
5692
5521
|
const methodId = data.input.substring(2, 10);
|
|
5693
5522
|
if (methodId == "095ea7b3") {
|
|
5694
5523
|
return "erc20_approve";
|
|
@@ -5698,7 +5527,7 @@ var Item = ({ data }) => {
|
|
|
5698
5527
|
}
|
|
5699
5528
|
return "unknown";
|
|
5700
5529
|
}, [data.input]);
|
|
5701
|
-
const to = (0,
|
|
5530
|
+
const to = (0, import_react39.useMemo)(() => {
|
|
5702
5531
|
if (!isOut) {
|
|
5703
5532
|
return data.from;
|
|
5704
5533
|
}
|
|
@@ -5711,7 +5540,7 @@ var Item = ({ data }) => {
|
|
|
5711
5540
|
}
|
|
5712
5541
|
return data.to;
|
|
5713
5542
|
}, [data.input, transferType, data.to, isOut]);
|
|
5714
|
-
const amount = (0,
|
|
5543
|
+
const amount = (0, import_react39.useMemo)(() => {
|
|
5715
5544
|
if (transferType == "erc20_transfer") {
|
|
5716
5545
|
const decodeData = (0, import_viem12.decodeFunctionData)({
|
|
5717
5546
|
abi: import_viem13.erc20Abi,
|
|
@@ -5729,7 +5558,7 @@ var Item = ({ data }) => {
|
|
|
5729
5558
|
refetchInterval: shouldRefetch ? 3e3 : false,
|
|
5730
5559
|
enabled: shouldRefetch && data.source == "local"
|
|
5731
5560
|
});
|
|
5732
|
-
const status = (0,
|
|
5561
|
+
const status = (0, import_react39.useMemo)(() => {
|
|
5733
5562
|
if (data.source == "matchain") {
|
|
5734
5563
|
switch (data.extra.status) {
|
|
5735
5564
|
case "ok":
|
|
@@ -5756,30 +5585,30 @@ var Item = ({ data }) => {
|
|
|
5756
5585
|
}
|
|
5757
5586
|
return "loading";
|
|
5758
5587
|
}, [data.extra?.status, data.source, hashQuery.data]);
|
|
5759
|
-
(0,
|
|
5588
|
+
(0, import_react39.useEffect)(() => {
|
|
5760
5589
|
if (data.hash) {
|
|
5761
5590
|
setShouldRefetch(status == "loading");
|
|
5762
5591
|
}
|
|
5763
5592
|
}, [status, data.hash]);
|
|
5764
|
-
const symbol = (0,
|
|
5593
|
+
const symbol = (0, import_react39.useMemo)(() => {
|
|
5765
5594
|
if (transferType == "erc20_transfer") {
|
|
5766
5595
|
const contract = contracts[`${chainId}-${data.to.toLowerCase()}`];
|
|
5767
5596
|
return contract?.symbol || contract?.name || "unknown";
|
|
5768
5597
|
}
|
|
5769
5598
|
return chain?.nativeCurrency.symbol || chain?.nativeCurrency.name;
|
|
5770
5599
|
}, [transferType, chain, contracts, chainId, data.to]);
|
|
5771
|
-
return /* @__PURE__ */ (0,
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
5772
5601
|
"a",
|
|
5773
5602
|
{
|
|
5774
5603
|
href: explorerLink(`tx/${data.hash}`),
|
|
5775
5604
|
target: "_blank",
|
|
5776
5605
|
className: `matchid-transaction-item`,
|
|
5777
5606
|
children: [
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5779
|
-
/* @__PURE__ */ (0,
|
|
5780
|
-
/* @__PURE__ */ (0,
|
|
5781
|
-
/* @__PURE__ */ (0,
|
|
5782
|
-
/* @__PURE__ */ (0,
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-transacton-item-container`, children: [
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "matchid-transaction-item-icon", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ArrowSendIcon, { className: !isOut ? "rotate-180" : "" }) }),
|
|
5609
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-transaction-item-details`, children: [
|
|
5610
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-transaction-item-address`, children: formatAddress(to, 6, 4) }),
|
|
5611
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
5783
5612
|
"div",
|
|
5784
5613
|
{
|
|
5785
5614
|
className: `matchid-transaction-item-timestamp`,
|
|
@@ -5788,11 +5617,11 @@ var Item = ({ data }) => {
|
|
|
5788
5617
|
)
|
|
5789
5618
|
] })
|
|
5790
5619
|
] }),
|
|
5791
|
-
/* @__PURE__ */ (0,
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
status == "loading" && /* @__PURE__ */ (0,
|
|
5794
|
-
status == "success" && /* @__PURE__ */ (0,
|
|
5795
|
-
status == "error" && /* @__PURE__ */ (0,
|
|
5620
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: `matchid-transaction-item-amount ${"matchid-transaction-item-" + status}`, children: [
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(NumberFormatter, { value: amount, tFixNum: 6, prefix: isOut ? "-" : "+", suffix: " " + symbol }),
|
|
5622
|
+
status == "loading" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(LoadingIcon_default, { color: "#000000", size: 16, rotate: true }),
|
|
5623
|
+
status == "success" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CheckRoundIcon, { size: 16 }),
|
|
5624
|
+
status == "error" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(InfoRoundIcon, { size: 16 })
|
|
5796
5625
|
] })
|
|
5797
5626
|
]
|
|
5798
5627
|
}
|
|
@@ -5802,19 +5631,19 @@ function TransactionList({
|
|
|
5802
5631
|
scrollableTarget
|
|
5803
5632
|
}) {
|
|
5804
5633
|
const { fetchMoreData, hasMore, items } = useMatchWalletRecords();
|
|
5805
|
-
return /* @__PURE__ */ (0,
|
|
5634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
5806
5635
|
import_react_infinite_scroll_component.default,
|
|
5807
5636
|
{
|
|
5808
5637
|
scrollableTarget,
|
|
5809
5638
|
dataLength: items.length,
|
|
5810
5639
|
next: fetchMoreData,
|
|
5811
5640
|
hasMore,
|
|
5812
|
-
loader: /* @__PURE__ */ (0,
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5641
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "matchid-list-nomore", children: [
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(LoadingIcon_default, { rotate: true, size: 16, color: "black" }),
|
|
5814
5643
|
"Loading..."
|
|
5815
5644
|
] }),
|
|
5816
|
-
endMessage: items.length > 0 ? /* @__PURE__ */ (0,
|
|
5817
|
-
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0,
|
|
5645
|
+
endMessage: items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl21.FormattedMessage, { id: "noMoreRecords" }) }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-list-nomore`, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_intl21.FormattedMessage, { id: "noRecords" }) }),
|
|
5646
|
+
children: items.length == 0 && !hasMore ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "mt-[150px]" }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: `matchid-transaction-list`, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Item, { data: item }, index)) })
|
|
5818
5647
|
}
|
|
5819
5648
|
);
|
|
5820
5649
|
}
|
|
@@ -5833,7 +5662,6 @@ function TransactionList({
|
|
|
5833
5662
|
ModalWithHeader,
|
|
5834
5663
|
Overlay,
|
|
5835
5664
|
Popover,
|
|
5836
|
-
SOLModal,
|
|
5837
5665
|
TONModal,
|
|
5838
5666
|
TRONModal,
|
|
5839
5667
|
TokenDetail,
|