From 1a37fe29f246dedadd00f0521e479dc0be1d233e Mon Sep 17 00:00:00 2001 From: john Date: Mon, 24 Jun 2024 18:35:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 待测试 --- .env.development | 6 +- .env.production | 3 +- src/contract/abi/RedDevils.json | 723 ++++++++++++++++++++------------ src/contract/utils.ts | 83 +++- src/pages/Home.tsx | 20 +- src/pages/LevelUp.tsx | 8 +- src/pages/Mint.tsx | 11 +- src/server/module.d.ts | 3 +- src/utils/index.ts | 3 +- src/utils/wallet.ts | 8 +- 10 files changed, 560 insertions(+), 308 deletions(-) diff --git a/.env.development b/.env.development index 1b2e05a..30e40ec 100644 --- a/.env.development +++ b/.env.development @@ -1,12 +1,12 @@ ### # @LastEditors: John # @Date: 2024-06-18 10:12:21 - # @LastEditTime: 2024-06-22 11:22:13 + # @LastEditTime: 2024-06-24 18:25:07 # @Author: John ### VITE_BASE_URL=http://192.168.10.167:5173/ VITE_BASE_API_URL=/dev VITE_PARTICIPATE_CHAIN_ID=97 -VITE_PURCHASED_CONTRACT_ADDRESS=0x37644e2E1Ac2D0b87f693Ad64A154f3A7fe09b93 -VITE_NETWORK_USDT_ADDRESS=0xACFE3DF8ACeF83De51d53E22ADE30F18eaB4969A +VITE_PURCHASED_CONTRACT_ADDRESS=0xD70762bf8682b68bd0cbbBC0cdeC81db4f00AEc6 +VITE_NETWORK_USDT_ADDRESS=0xf9A18B7FC8Eb118f8Ad59fBD6eb1A181eaCb4E63 VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/ \ No newline at end of file diff --git a/.env.production b/.env.production index b534bc1..340abfe 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,6 @@ VITE_BASE_URL=/ VITE_BASE_API_URL=/dev VITE_PARTICIPATE_CHAIN_ID=56 -VITE_NETWORK_USDT_ADDRESS=0x55d398326f99059ff775485246999027b3197955 +VITE_PURCHASED_CONTRACT_ADDRESS= +VITE_NETWORK_USDT_ADDRESS= VITE_CHECK_TRANSACTION_DETAILS_URL=https://bscscan.com/ \ No newline at end of file diff --git a/src/contract/abi/RedDevils.json b/src/contract/abi/RedDevils.json index 4a8d0c0..3c1f3f3 100644 --- a/src/contract/abi/RedDevils.json +++ b/src/contract/abi/RedDevils.json @@ -1,268 +1,457 @@ [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "orderId", - "type": "uint256" - } - ], - "name": "buyHMNFT", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "hongMoAddr", - "type": "address" - }, - { - "internalType": "address", - "name": "payAddr", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "OwnableInvalidOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "OwnableUnauthorizedAccount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "buyAddr", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "orderId", - "type": "uint256" - } - ], - "name": "BuySuccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenIn", - "type": "uint256" - } - ], - "name": "setTokenIndex", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "orderId", - "type": "uint256" - } - ], - "name": "upgradePrivilege", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "buyAddr", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "orderId", - "type": "uint256" - } - ], - "name": "UpgradeRange", - "type": "event" - }, - { - "inputs": [], - "name": "hongMoNFT", - "outputs": [ - { - "internalType": "contract HongMoNFT", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "usdc", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "hongMoAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "payAddr", + "type": "address" + }, + { + "internalType": "address", + "name": "p1", + "type": "address" + }, + { + "internalType": "address", + "name": "p2", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "buyAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + } + ], + "name": "BuySuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "buyAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + } + ], + "name": "RewardSuccess", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "buyAddr", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + } + ], + "name": "UpgradeRange", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymentType", + "type": "uint256" + } + ], + "name": "buyHMNFT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + } + ], + "name": "getOrderStatus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hongMoNFT", + "outputs": [ + { + "internalType": "contract HongMoNFT", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "payee1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "payee2", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "price", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "paymentTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "hashStr", + "type": "bytes32" + } + ], + "name": "reward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setNFTAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "a", + "type": "address" + }, + { + "internalType": "address", + "name": "b", + "type": "address" + } + ], + "name": "setPayeeAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "p", + "type": "uint256" + } + ], + "name": "setPrice", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setTokenIndex", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setUSDCAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "source", + "type": "string" + } + ], + "name": "stringToBytes32", + "outputs": [ + { + "internalType": "bytes32", + "name": "result", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + } + ], + "name": "upgradePrivilege", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usdc", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/contract/utils.ts b/src/contract/utils.ts index 5628080..1897d3b 100644 --- a/src/contract/utils.ts +++ b/src/contract/utils.ts @@ -1,7 +1,7 @@ /* * @LastEditors: John * @Date: 2024-06-19 15:48:57 - * @LastEditTime: 2024-06-24 11:09:12 + * @LastEditTime: 2024-06-24 18:25:44 * @Author: John */ import { config } from "@/components/WalletProvider"; @@ -16,8 +16,6 @@ import { encodeFunctionData } from "viem/utils"; import erc20Abi from "@/contract/abi/erc20abi.json"; import usdtAbi from "@/contract/abi/USDT.json"; import RedDevilsAbi from "@/contract/abi/RedDevils.json"; -import Toast from "antd-mobile/es/components/toast"; -import { EstimateGasErrorType, WriteContractErrorType } from "viem"; import i18next from "i18next"; import { BaseError } from "wagmi"; @@ -145,7 +143,11 @@ export const authorizedU = async (uNum: bigint) => { * @param orderID * @returns */ -export async function payByContract(amount: bigint, orderID: string) { +export async function payByContract( + amount: bigint, + orderID: string, + payInduction: number +) { console.log("pay buy contract params", { amount, orderID }); console.log("NETWORK_USDT:", import.meta.env.VITE_NETWORK_USDT_ADDRESS); @@ -164,13 +166,13 @@ export async function payByContract(amount: bigint, orderID: string) { await authorizedU(amount); } - console.log("参数:", amount, orderID); + console.log("参数:", amount, orderID, payInduction); estimateGas(config, { to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, data: encodeFunctionData({ abi: RedDevilsAbi, functionName: "buyHMNFT", - args: [amount, orderID], + args: [amount, orderID, payInduction], }), }) .then((gas) => { @@ -180,7 +182,7 @@ export async function payByContract(amount: bigint, orderID: string) { abi: RedDevilsAbi, address: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, functionName: "buyHMNFT", - args: [amount, orderID], + args: [amount, orderID, payInduction], gas: gasPrice, }) .then((receipt) => { @@ -188,12 +190,12 @@ export async function payByContract(amount: bigint, orderID: string) { reslove(receipt); }) .catch((err: BaseError) => { - console.log("buyHMNFT Transaction err", err.details); + console.log("buyHMNFT Transaction err", err); reject(err); }); }) .catch((err: BaseError) => { - console.log("buyHMNFT estimateGas err", err.details); + console.log("buyHMNFT estimateGas err", err); reject(err); }); } catch (err) { @@ -252,12 +254,12 @@ export async function upGradeByContract(amount: bigint, orderID: string) { reslove(receipt); }) .catch((err: BaseError) => { - console.log("upgradePrivilege Transaction err", err.details); + console.log("upgradePrivilege Transaction err", err); reject(err); }); }) .catch((err: BaseError) => { - console.log("upgradePrivilege estimateGas err", err.details); + console.log("upgradePrivilege estimateGas err", err); reject(err); }); } catch (err) { @@ -272,9 +274,64 @@ export async function upGradeByContract(amount: bigint, orderID: string) { * @param orderID * @returns */ -export async function receiveByContract(amount: bigint, orderID: string) { +export async function receiveByContract( + amount: bigint, + paymentTime: number, + orderID: string, + hashStr: string +) { console.log("pay buy contract params", { amount, orderID }); console.log("NETWORK_USDT:", import.meta.env.VITE_NETWORK_USDT_ADDRESS); - return new Promise(async (reslove, reject) => {}); + return new Promise(async (reslove, reject) => { + try { + const balance = await getBalance(); + if (balance < amount) { + console.log("用户代币余额不足"); + reject(new BaseError(i18next.t("余额不足"))); + return; + } + + console.log("当前要授权的U:", amount); + let approvedU = await getApproveUsdt(); + if (approvedU < amount) { + await authorizedU(amount); + } + + console.log("参数:", amount, paymentTime, orderID, hashStr); + estimateGas(config, { + to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, + data: encodeFunctionData({ + abi: RedDevilsAbi, + functionName: "reward", + args: [amount, paymentTime, orderID, hashStr], + }), + }) + .then((gas) => { + const gasPrice = (gas * 12n) / 10n; + console.log("estimate gas:%d , my gas: %d", gas, gasPrice); + writeContract(config, { + abi: RedDevilsAbi, + address: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS, + functionName: "reward", + args: [amount, paymentTime, orderID, hashStr], + gas: gasPrice, + }) + .then((receipt) => { + console.log("write contract success!, receipt:", receipt); + reslove(receipt); + }) + .catch((err: BaseError) => { + console.log("reward Transaction err", err); + reject(err); + }); + }) + .catch((err: BaseError) => { + console.log("reward estimateGas err", err); + reject(err); + }); + } catch (err) { + reject(new BaseError(`${err}`)); + } + }); } diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 1300004..baac00e 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -13,13 +13,9 @@ import { BaseError, useAccount } from "wagmi"; import { disconnect } from "wagmi/actions"; import { config } from "@/components/WalletProvider"; import { useNavigate } from "react-router-dom"; -import { Button, Dialog, Ellipsis, Empty, Toast } from "antd-mobile"; -import { loginOut, signAndLogin } from "@/utils/wallet"; -import { - api_claim_income, - api_get_homepage_user_data, - api_users_cancel_orders, -} from "@/server/api"; +import { Button, Dialog, Empty, Toast } from "antd-mobile"; +import { loginOut } from "@/utils/wallet"; +import { api_claim_income, api_get_homepage_user_data } from "@/server/api"; import { UserHomeData } from "@/server/module"; import { UrlQueryParamsKey } from "@/constants"; import { receiveByContract } from "@/contract/utils"; @@ -44,7 +40,7 @@ export default function () { [userData] ); const receiveLoadingToast = useRef(); - const { transcationStatus, startPollingCheckBuyStatus } = + const { transcationStatus, startPollingCheckBuyStatus,stopPollingCheckBuyStatus } = usePollingCheckBuyStatus("NORMAL"); useEffect(() => { @@ -55,6 +51,7 @@ export default function () { useEffect(() => { if (transcationStatus == "success") { receiveLoadingToast.current?.close(); + stopPollingCheckBuyStatus() Dialog.alert({ content: `${t("领取成功,前往钱包查看")}`, confirmText: "OK", @@ -297,7 +294,12 @@ export default function () { const buyAmount = BigInt( orderInfo?.claimQuantity || "" ); - receiveByContract(buyAmount, orderInfo?.orderNumber) + receiveByContract( + buyAmount, + orderInfo.time, + orderInfo?.orderNumber, + orderInfo.hash + ) .then((hash) => { console.log("领取成功!hash:", hash); getHomeData(); diff --git a/src/pages/LevelUp.tsx b/src/pages/LevelUp.tsx index 6a44d35..4014503 100644 --- a/src/pages/LevelUp.tsx +++ b/src/pages/LevelUp.tsx @@ -38,8 +38,11 @@ export default function () { const upgradeLoadingtoast = useRef(); const orderInfo = useRef(); - const { transcationStatus, startPollingCheckBuyStatus } = - usePollingCheckBuyStatus("NORMAL"); + const { + transcationStatus, + startPollingCheckBuyStatus, + stopPollingCheckBuyStatus, + } = usePollingCheckBuyStatus("NORMAL"); useEffect(() => { updateUserUpgrdeInfo(); return () => {}; @@ -66,6 +69,7 @@ export default function () { useEffect(() => { if (transcationStatus == "success") { upgradeLoadingtoast.current?.close(); + stopPollingCheckBuyStatus(); Dialog.alert({ content: `${t("升级成功,返回首页查看")}`, confirmText: "OK", diff --git a/src/pages/Mint.tsx b/src/pages/Mint.tsx index d6f1bbe..e591a33 100644 --- a/src/pages/Mint.tsx +++ b/src/pages/Mint.tsx @@ -1,7 +1,7 @@ /* * @LastEditors: John * @Date: 2024-06-18 15:28:03 - * @LastEditTime: 2024-06-24 11:08:14 + * @LastEditTime: 2024-06-24 18:28:07 * @Author: John */ import { cn } from "@/utils"; @@ -41,7 +41,7 @@ export default function () { const buyLoadingToast = useRef(); const approveLoadingToast = useRef(); - const { buyNftIds, startPollingCheckBuyStatus } = + const { buyNftIds, startPollingCheckBuyStatus, stopPollingCheckBuyStatus } = usePollingCheckBuyStatus("NFT"); const approvePrice = useMemo( @@ -73,6 +73,7 @@ export default function () { useEffect(() => { if (buyNftIds) { buyLoadingToast.current?.close(); + stopPollingCheckBuyStatus(); Dialog.alert({ content: `${t("MINT成功,返回首页查看")}`, confirmText: "OK", @@ -176,7 +177,11 @@ export default function () { orderInfo.current = orderRes?.data; if (!orderInfo.current?.orderNumber) return; const buyAmount = BigInt(orderInfo.current?.buyAmount || ""); - payByContract(buyAmount, orderInfo.current?.orderNumber) + payByContract( + buyAmount, + orderInfo.current?.orderNumber, + orderInfo.current.payInduction + ) .then((hash) => { console.log("购买成功!hash:", hash); updateNftConfig(); diff --git a/src/server/module.d.ts b/src/server/module.d.ts index 5ed2137..6cbece8 100644 --- a/src/server/module.d.ts +++ b/src/server/module.d.ts @@ -102,6 +102,7 @@ export interface NftOrder { updateBy: string; updateTime: string; userId: number; + payInduction: number; } export interface PreprelionListItem { @@ -133,5 +134,5 @@ export interface ClaimIncome { claimQuantity: string; hash: string; orderNumber: string; - time: string; + time: number; } diff --git a/src/utils/index.ts b/src/utils/index.ts index 954ec1c..fb0d34c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,7 +1,7 @@ /* * @LastEditors: John * @Date: 2024-06-17 18:19:27 - * @LastEditTime: 2024-06-22 15:26:37 + * @LastEditTime: 2024-06-24 14:49:16 * @Author: John */ import { type ClassValue, clsx } from "clsx"; @@ -14,7 +14,6 @@ export const ua = navigator.userAgent; export const isIOS = /iphone|ipad|ipod|ios/i.test(ua); export const isAndroid = /android|XiaoMi|MiuiBrowser/i.test(ua); export const isMobile = isIOS || isAndroid; -export const isOKApp = /OKApp/i.test(ua); export function shortenString( inputString: string, diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 5a6bc98..761a7ff 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -1,7 +1,7 @@ /* * @LastEditors: John * @Date: 2024-06-19 15:55:07 - * @LastEditTime: 2024-06-20 16:30:22 + * @LastEditTime: 2024-06-24 14:01:50 * @Author: John */ import { config } from "@/components/WalletProvider"; @@ -13,17 +13,11 @@ import { } from "@/server/api"; import useUserStore from "@/store/User"; import { - writeContract, - readContract, - estimateGas, - waitForTransactionReceipt, - getConnectorClient, signMessage, getChains, switchChain, getChainId, disconnect, - getAccount, } from "@wagmi/core"; import Toast from "antd-mobile/es/components/toast"; import i18next from "i18next";