-
Notifications
You must be signed in to change notification settings - Fork 7
/
.eslintcache
1 lines (1 loc) · 57.3 KB
/
.eslintcache
1
[{"E:\\Lokian.eth\\src\\index.tsx":"1","E:\\Lokian.eth\\src\\AppContainer.tsx":"2","E:\\Lokian.eth\\src\\App.tsx":"3","E:\\Lokian.eth\\src\\utils\\txFail.js":"4","E:\\Lokian.eth\\src\\utils\\txSuccess.js":"5","E:\\Lokian.eth\\src\\wallet\\connectors.ts":"6","E:\\Lokian.eth\\src\\wallet\\hooks.ts":"7","E:\\Lokian.eth\\src\\StatBar.tsx":"8","E:\\Lokian.eth\\src\\components\\Spinner.tsx":"9","E:\\Lokian.eth\\src\\sprites-copy\\index.js":"10","E:\\Lokian.eth\\src\\sprites\\index.js":"11"},{"size":203,"mtime":1632645713483,"results":"12","hashOfConfig":"13"},{"size":461,"mtime":1632416988498,"results":"14","hashOfConfig":"13"},{"size":47778,"mtime":1649592145865,"results":"15","hashOfConfig":"13"},{"size":378,"mtime":1648916010540,"results":"16","hashOfConfig":"13"},{"size":408,"mtime":1648916010540,"results":"17","hashOfConfig":"13"},{"size":215,"mtime":1649513498865,"results":"18","hashOfConfig":"13"},{"size":2588,"mtime":1633872796792,"results":"19","hashOfConfig":"13"},{"size":257,"mtime":1633872639985,"results":"20","hashOfConfig":"13"},{"size":805,"mtime":1633340784350,"results":"21","hashOfConfig":"13"},{"size":7315,"mtime":1648804917278,"results":"22","hashOfConfig":"13"},{"size":7315,"mtime":1648804917278,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"18w6p6u",{"filePath":"27","messages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"29","usedDeprecatedRules":"26"},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"32"},{"filePath":"33","messages":"34","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"35"},{"filePath":"36","messages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"35"},{"filePath":"38","messages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"40","messages":"41","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"42","usedDeprecatedRules":"26"},{"filePath":"43","messages":"44","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"45","messages":"46","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"47","messages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"35"},{"filePath":"49","messages":"50","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"51"},"E:\\Lokian.eth\\src\\index.tsx",[],["52","53"],"E:\\Lokian.eth\\src\\AppContainer.tsx",["54"],"import React from 'react'\r\nimport { Web3ReactProvider } from '@web3-react/core'\r\nimport App from './App'\r\nimport { Web3Provider } from '@ethersproject/providers'\r\n\r\nfunction getLibrary(provider: any): Web3Provider {\r\n const library = new Web3Provider(provider)\r\n library.pollingInterval = 12000\r\n return library\r\n}\r\n\r\nexport default function () {\r\n return (\r\n <Web3ReactProvider getLibrary={getLibrary}>\r\n <App />\r\n </Web3ReactProvider>\r\n )\r\n}\r\n","E:\\Lokian.eth\\src\\App.tsx",["55","56","57"],"import React, { useEffect, useState } from 'react'\nimport './App.css'\nimport 'bootstrap/dist/css/bootstrap.min.css'\nimport { Tab, Tabs } from 'react-bootstrap'\nimport StatBar from './StatBar'\nimport { ToastContainer, toast } from 'react-toastify'\nimport 'react-toastify/dist/ReactToastify.css'\nimport { Spinner } from './components/Spinner'\n\n// Library to work with Ethereum like blockchain\nimport { injected } from './wallet/connectors'\nimport { useEagerConnect, useInactiveListener } from './wallet/hooks'\nimport {\n NoEthereumProviderError,\n UserRejectedRequestError as UserRejectedRequestErrorInjected,\n} from '@web3-react/injected-connector'\nimport { useWeb3React, UnsupportedChainIdError } from '@web3-react/core'\nimport { Contract } from '@ethersproject/contracts'\nimport { BigNumber } from '@ethersproject/bignumber'\nimport { formatUnits, parseEther, formatEther } from '@ethersproject/units'\n\n// abis\nimport contrInterface from './interface.json' // Load contract json file\nimport erc20Interface from './erc20Interface.json' // Load erc20 contract json file\nimport nftInterface from './project.nft.abi.json'\n\n// Load all the background images for the 10 different Cryptomon types\nimport bg0 from './sprites-copy/background/0.png'\nimport bg1 from './sprites-copy/background/1.png'\nimport bg2 from './sprites-copy/background/2.png'\nimport bg3 from './sprites-copy/background/3.png'\nimport bg4 from './sprites-copy/background/4.png'\nimport bg5 from './sprites-copy/background/5.png'\nimport bg6 from './sprites-copy/background/6.png'\nimport bg7 from './sprites-copy/background/7.png'\nimport bg8 from './sprites-copy/background/8.png'\nimport bg9 from './sprites-copy/background/9.png'\nimport bg10 from './sprites-copy/background/10.png'\n\nimport MonImages from './sprites-copy'\n\n// util\nimport { Web3Provider } from '@ethersproject/providers'\nimport txSuccess from './utils/txSuccess'\nimport txFail from './utils/txFail'\n\nenum ConnectorNames {\n Injected = 'Injected',\n}\n\nconst connectorsByName: { [connectorName in ConnectorNames]: any } = {\n [ConnectorNames.Injected]: injected,\n}\n\nconst CONTRACT_ADDRESS = '0x6d88cBBD35E19958eFB4500f93D346c126bB7Df2'\nconst ERC20_CONTRACT_ADDRESS = '0x7664e0A3862819C48A01648CE5139Ad25dAC12c0'\nconst ERC1155_CONTRACT_ADDRESS = '0xD2f9F7C2CD1b8e1C91d89F271EF80eBFf75F183C'\n\n// Add background images in an array for easy access\nconst bg = [bg0, bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8, bg9, bg10]\n\n// Add all 151 Cryptomon names in an array\nconst names = [\n 'Dryad',\n 'Hamadryad',\n 'Leshy',\n 'Santelmo',\n 'Cerberus',\n 'Efreet',\n 'Fastitocalon',\n 'Aspidochelone',\n 'Zaratan',\n 'Arachne',\n 'Jorogumo',\n 'Tsuchigumo',\n 'Pabilsag',\n 'Girtablilu',\n 'Selket',\n 'Tsikavats',\n 'Munnin',\n 'Huginn',\n 'Azeban',\n 'Ratatoskr',\n 'Stratim',\n 'Navka',\n 'Apep',\n 'Nidhoggr',\n 'Raiju',\n 'Raijin',\n 'Amphivena',\n 'Basilisk',\n 'Wolpertinger',\n 'Ramidreju',\n 'Echinemon',\n 'Mujina',\n 'Kamaitachi',\n 'Lavellan',\n 'Vila',\n 'Huldra',\n 'Chimera',\n 'Kyuubi',\n 'Nixie',\n 'Tuathan',\n 'Minyades',\n 'Camazotz',\n 'Curupira',\n 'Penghou',\n 'Ghillie_Dhu',\n 'Myrmecoleon',\n 'Myrmidon',\n 'Mothman',\n 'Moth_King',\n 'Grootslang',\n 'Yaoguai',\n 'Cait_Sidhe',\n 'Cath_Balug',\n 'Nakki',\n 'Kappa',\n 'Satori',\n 'Shojo',\n 'Skohl',\n 'Haet',\n 'Vodyanoy',\n 'Undine',\n 'Melusine',\n 'Vukodlak',\n 'Chernobog',\n 'Djinn',\n 'Bauk',\n 'Troll',\n 'Jotun',\n 'Spriggan',\n 'Jubokko',\n 'Kodama',\n 'Bukavak',\n 'Kraken',\n 'Clayboy',\n 'Met',\n 'Emet',\n 'Sleipnir',\n 'Todorats',\n 'Scylla',\n 'Charybdis',\n 'Brontes',\n 'Arges',\n 'Hraesvelgr',\n 'Berunda',\n 'Cockatrice',\n 'Selkie',\n 'Rusalka',\n 'Tarasque',\n 'Meretseger',\n 'Carbuncle',\n 'Shen',\n 'Boogeyman',\n 'Banshee',\n 'Mare',\n 'Dilong',\n 'Incubus',\n 'Succubus',\n 'Cancer',\n 'Karkinos',\n 'Druk',\n 'Shenlong',\n 'Gan_Ceann',\n 'Oni',\n 'Tairanohone',\n 'Gashadokuro',\n 'Yeren',\n 'Yeti',\n 'Yowie',\n 'Nezhit',\n 'Chuma',\n 'Sigbin',\n 'Gargoyle',\n 'Caladrius',\n 'Umibozu',\n 'Callisto',\n 'Kelpie',\n 'Makara',\n 'Morgen',\n 'Merrow',\n 'Naiad',\n 'Nereid',\n 'Pixiu',\n 'Khepri',\n 'Likho',\n 'kitsune',\n 'Caorthannach',\n 'Kaggen',\n 'Audumbla',\n 'Lochness',\n 'Jormungandr',\n 'Leviathan',\n 'Doppelganger',\n 'Skvader',\n 'Fossegrim',\n 'Valkyrie',\n 'Basan',\n 'Tsukumogami',\n 'Luska',\n 'Hydra',\n 'Afanc',\n 'Cetus',\n 'Vedfolnir',\n 'Baku',\n 'Alkonost',\n 'Quetzalcoatl',\n 'Anzu',\n 'Zmey',\n 'Azhdaya',\n 'Fafnir',\n 'Baba_Yaga',\n 'Baba_Roga',\n]\n\nasync function getMons(_library, _account) {\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, _library.getSigner(_account))\n const totalMons = parseInt(await contr.totalMons())\n return Promise.all([...Array(totalMons).keys()].map((id) => contr.mons(id)))\n}\n\nasync function approve(_library, _account, _amount) {\n const erc20Contr = new Contract(ERC20_CONTRACT_ADDRESS, erc20Interface, _library.getSigner(_account))\n const newAmount = `${parseEther(_amount)}`\n return await erc20Contr.approve(CONTRACT_ADDRESS, newAmount)\n}\n\nfunction Account() {\n const { account } = useWeb3React()\n return (\n <span>\n {account === null ? '-' : account ? `${account.substring(0, 6)}...${account.substring(account.length - 4)}` : ''}\n </span>\n )\n}\n\nasync function getTokenBalance(_library, _account) {\n if (!_library || !_account) {\n return\n }\n const erc20Contr = new Contract(ERC20_CONTRACT_ADDRESS, erc20Interface, _library.getSigner(_account))\n const bal = await erc20Contr.balanceOf(_account)\n return formatEther(BigNumber.from(bal?._hex).toBigInt())\n}\n\nfunction getErrorMessage(error: Error) {\n if (error instanceof NoEthereumProviderError) {\n return 'No Ethereum browser extension detected, install MetaMask on desktop or visit from a dApp browser on mobile.'\n } else if (error instanceof UnsupportedChainIdError) {\n return \"You're connected to an unsupported network.\"\n } else if (error instanceof UserRejectedRequestErrorInjected) {\n return 'Please authorize this website to access your Ethereum account.'\n } else {\n console.error(error)\n return 'An unknown error occurred. Check the console for more details.'\n }\n}\n\nfunction App() {\n const [cryptomons, setCryptomons] = useState([])\n const [myCryptomons, setMyCryptomons] = useState([])\n const [otherCryptomons, setOtherCryptomons] = useState([])\n const [value, setValue] = useState(0) // Used in My Cryptomons tab for input in price text\n // Used in breeding tab\n const [breedChoice1, setBreedChoice1] = useState(null)\n const [breedChoice2, setBreedChoice2] = useState(null)\n // Used in fighting tab\n const [fightChoice1, setFightChoice1] = useState(null)\n const [fightChoice2, setFightChoice2] = useState(null)\n const [winner, setWinner] = useState(null) // Used to display winner of the last fight\n const [rounds, setRounds] = useState(null) // Used to display number of rounds the fight lasted\n const [shareId, setShareId] = useState('') // Used in shareId form input field\n const [shareAddress, setShareAddress] = useState('') // Used in shareAddress form input field\n const [tokenBalance, setTokenBalance] = useState('0')\n const [fightTxDone, setFightTxDone] = useState(false)\n const [rewards, setRewards] = useState(0)\n const [healingPotions, setHealingPotions] = useState(null)\n const [manaPotions, setManaPotions] = useState(null)\n const [magicPotions, setMagicPotions] = useState(null)\n const [swords, setSwords] = useState(null)\n const [shields, setShields] = useState(null)\n const [disableFightBtn, setDisableFightBtn] = useState(false)\n const [buyItemAmount, setBuyItemAmount] = useState('0')\n const [burnAmount, setBurnAmount] = useState('0')\n const [disableBuyItemBtn, setDisableBuyItem] = useState(false)\n const [isShareLoading, setIsShareLoading] = useState(false)\n const [isStopSharingLoading, setIsStopSharingLoading] = useState(false)\n const [isBreedMonLoading, setIsBreedMonLoading] = useState(false)\n const [isBuyMonLoading, setIsBuyMonLoading] = useState(false)\n const [isAddForSaleLoading, setIsAddForSaleLoading] = useState(false)\n const [isRemoveFromSaleLoading, setIsRemoveFromSaleLoading] = useState(false)\n const context = useWeb3React<Web3Provider>()\n const { connector, account, library, activate, deactivate, active, error } = context\n\n // handle logic to recognize the connector currently being activated\n const [activatingConnector, setActivatingConnector] = React.useState<any>()\n useEffect(() => {\n if (activatingConnector && activatingConnector === connector) {\n setActivatingConnector(undefined)\n }\n\n refreshMons()\n }, [activatingConnector, connector])\n\n // Get token balance of user\n useEffect(() => {\n let mounted = true\n\n getTokenBalance(library, account).then((res) => {\n if (mounted) {\n setTokenBalance(res)\n refreshMons()\n }\n })\n\n return () => {\n mounted = false\n }\n }, [account, library, disableBuyItemBtn, disableFightBtn])\n\n // Get contract events\n useEffect(() => {\n if (!library || !account) {\n return\n }\n\n let mounted = true\n\n ;(async function fightResults() {\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n\n contr.on('FightResults', (_winnerId, _round) => {\n if (mounted) {\n const winId = BigNumber.from(_winnerId._hex).toNumber()\n const round = BigNumber.from(_round._hex).toNumber()\n setWinner(winId)\n setRounds(round)\n refreshMons()\n setDisableFightBtn(false)\n }\n })\n\n contr.on('Rewards', (_winnerId, _rewards) => {\n if (mounted) {\n const rewards = BigNumber.from(_rewards._hex).toNumber()\n setRewards(rewards)\n refreshMons()\n setDisableFightBtn(false)\n }\n })\n })()\n\n return () => {\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n contr.off('FightResults', (_winnerId, _round) => {\n setDisableFightBtn(false)\n })\n contr.off('Rewards', (_winnerId, _round) => {\n setDisableFightBtn(false)\n })\n\n mounted = false\n }\n }, [account, library, fightTxDone])\n\n // Get items from nft contract\n useEffect(() => {\n if (!library || !account) {\n return\n }\n\n let mounted = true\n\n ;(async function () {\n if (mounted) {\n const nftContr = new Contract(ERC1155_CONTRACT_ADDRESS, nftInterface, library.getSigner(account))\n const healpot = await nftContr.balanceOf(account, 0)\n const manapot = await nftContr.balanceOf(account, 1)\n const magicpot = await nftContr.balanceOf(account, 2)\n const _swords = await nftContr.balanceOf(account, 3)\n const _shields = await nftContr.balanceOf(account, 4)\n\n setHealingPotions(BigNumber.from(healpot._hex).toBigInt())\n setManaPotions(BigNumber.from(manapot._hex).toBigInt())\n setMagicPotions(BigNumber.from(magicpot._hex).toBigInt())\n setSwords(BigNumber.from(_swords._hex).toBigInt())\n setShields(BigNumber.from(_shields._hex).toBigInt())\n }\n })()\n\n return () => {\n mounted = false\n }\n }, [library, account, disableBuyItemBtn])\n\n // handle logic to eagerly connect to the injected ethereum provider, if it exists and has granted access already\n const triedEager = useEagerConnect()\n\n // handle logic to connect in reaction to certain events on the injected ethereum provider, if it exists\n useInactiveListener(!triedEager || !!activatingConnector)\n\n // Change the list of created Crypromons saved in the state so UI refreshes after this call\n async function refreshMons() {\n if (!library || !account) return\n await getMons(library, account)\n .then((_mons) => {\n // map result\n const monsMap = _mons.map((mon) => ({\n atk: mon.atk,\n def: mon.def,\n evolve: mon.evolve,\n forSale: mon.forSale,\n hp: mon.hp,\n id: BigNumber.from(mon.id._hex).toNumber(),\n monType: mon.monType,\n owner: mon.owner,\n price: BigNumber.from(mon.price._hex).toBigInt(),\n sharedTo: mon.sharedTo,\n species: mon.species,\n speed: mon.speed,\n }))\n setCryptomons(monsMap)\n setMyCryptomons(monsMap.filter((mon) => mon.owner === account))\n setOtherCryptomons(monsMap.filter((mon) => mon.owner !== account))\n })\n .catch((err) => toast.error(err))\n }\n\n // Function that buys a Cryptomon through a smart contract function\n async function buyMon(id, price) {\n setIsBuyMonLoading(true)\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n const newprice = `${BigInt(price)}`\n let overrides = {\n value: newprice,\n gasLimit: 120000,\n }\n\n const tx = await contr.buyMon(id, overrides).catch((err) => setIsBuyMonLoading(false))\n const recpt = await tx?.wait()\n txSuccess(recpt, toast, refreshMons, (loadVal: boolean) => setIsBuyMonLoading(loadVal))\n txFail(recpt, toast, (loadVal: boolean) => setIsBuyMonLoading(loadVal))\n }\n\n // Function that adds a Cryptomon for sale through a smart contract function\n async function addForSale(id, price) {\n setIsAddForSaleLoading(true)\n if (price === 0 || price === '0') {\n toast.error('🦄 Price is 0')\n return\n }\n let overrides = {\n gasLimit: 120000,\n }\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n const tx = await contr.addForSale(id, parseEther(price), overrides).catch((err) => setIsAddForSaleLoading(false))\n const receipt = await tx?.wait()\n if (receipt && receipt.status === 1) {\n toast.success(`Success, Tx hash: ${receipt.transactionHash}`)\n refreshMons()\n setIsAddForSaleLoading(false)\n }\n if (receipt && receipt.status === 0) {\n toast.error(`Error, Tx hash: ${receipt.transactionHash}`)\n setIsAddForSaleLoading(false)\n }\n }\n\n // Function that removes a Cryptomon from sale through a smart contract function\n async function removeFromSale(id) {\n setIsRemoveFromSaleLoading(true)\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n let overrides = {\n gasLimit: 120000,\n }\n const tx = await contr.removeFromSale(id, overrides).catch((err) => setIsRemoveFromSaleLoading(false))\n const recpt = await tx?.wait()\n if (recpt && recpt.status === 1) {\n toast.success(`Success, Tx hash: ${recpt.transactionHash}`)\n refreshMons()\n setIsRemoveFromSaleLoading(false)\n }\n if (recpt && recpt.status === 0) {\n toast.error(`Error, Tx hash: ${recpt.transactionHash}`)\n setIsRemoveFromSaleLoading(false)\n }\n }\n\n // Function that breeds 2 Cryptomons through a smart contract function\n async function breedMons(id1, id2) {\n setIsBreedMonLoading(true)\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n const tx = await contr.breedMons(id1, id2).catch((err) => setIsBreedMonLoading(false))\n const recpt = await tx?.wait()\n if (recpt && recpt.status) {\n toast.success(`Success, Tx hash: ${recpt.transactionHash}`)\n setIsBreedMonLoading(false)\n }\n\n if (recpt && !recpt.status) {\n toast.error(`Error, Tx hash: ${recpt.transactionHash}`)\n setIsBreedMonLoading(false)\n }\n\n await refreshMons()\n }\n\n // Function that allows 2 Cryptomons to fight through a smart contract function\n async function fight(id1, id2) {\n setDisableFightBtn(true)\n if (id1 === null || id2 === null) {\n return\n }\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n let overrides = {\n gasLimit: 120000,\n }\n try {\n const tx = await contr.fight(id1, id2, overrides).catch((err) => setDisableFightBtn(false))\n const recpt = await tx?.wait()\n if (recpt && recpt.status) {\n setFightTxDone(true)\n }\n\n if (recpt && !recpt.status) {\n toast.error(`Error, Tx hash: ${recpt.transactionHash}`)\n setFightTxDone(false)\n }\n } catch (error) {\n toast.error(`Fight function error: ${error.data?.message || ''}`)\n setDisableFightBtn(false)\n }\n }\n\n // Function that starts sharing a Cryptomon to another address through a smart contract function\n async function startSharing(id, address) {\n setIsShareLoading(true)\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n let overrides = {\n gasLimit: 120000,\n }\n const tx = await contr.startSharing(id, address, overrides).catch((err) => setIsShareLoading(false))\n const recpt = await tx?.wait()\n if (recpt && recpt.status) {\n toast.success(`Success, Tx hash: ${recpt.transactionHash}`)\n refreshMons()\n setIsShareLoading(false)\n }\n if (recpt && !recpt.status) {\n toast.error(`Error, Tx hash: ${recpt.transactionHash}`)\n setIsShareLoading(false)\n }\n }\n\n // Function that stops sharing a Cryptomon with other addresses through a smart contrct function\n async function stopSharing(id) {\n setIsStopSharingLoading(true)\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n let overrides = {\n gasLimit: 120000,\n }\n const tx = await contr.stopSharing(id, overrides).catch((err) => setIsStopSharingLoading(false))\n const recpt = await tx?.wait()\n if (recpt && recpt.status) {\n toast.success(`Success, Tx hash: ${recpt.transactionHash}`)\n refreshMons()\n setIsStopSharingLoading(false)\n }\n\n if (recpt && !recpt.status) {\n toast.error(`Error, Tx hash: ${recpt.transactionHash}`)\n setIsStopSharingLoading(false)\n }\n }\n\n // Handlers for form inputs\n function handleShareId(event) {\n setShareId(event.target.value)\n }\n function handleShareAddress(event) {\n setShareAddress(event.target.value)\n }\n\n function handleChange(id, event) {\n setValue(event.target.value)\n }\n\n function handleBuyItemAmount(event) {\n setBuyItemAmount(event.target.value)\n }\n function handleBurn(event) {\n setBurnAmount(event.target.value)\n }\n\n async function buyItem(units: string, price: string, itemNumber: string, data: string = '0x00') {\n setDisableBuyItem(true)\n if (!units || !price || !itemNumber) {\n return\n }\n let overrides = {\n gasLimit: 120000,\n }\n const _price = parseEther(price)\n const priceInWei = `${BigNumber.from(_price._hex).toBigInt()}`\n approve(library, account, priceInWei)\n .then(async (results) => {\n if (results) {\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n const tx = await contr.buyItem(units, priceInWei, itemNumber, data, overrides)\n const recpt = await tx?.wait()\n txSuccess(recpt, toast, refreshMons)\n txFail(recpt, toast)\n } else {\n toast.error(`Error in approving`)\n }\n setDisableBuyItem(false)\n })\n .catch((e) => {\n toast.error(`Error: ${e?.message}`)\n setDisableBuyItem(false)\n })\n }\n\n async function burn(amount: string) {\n setDisableBuyItem(true)\n if (!amount) {\n return\n }\n const _amount = parseEther(amount)\n const amountInWei = `${BigNumber.from(_amount._hex).toBigInt()}`\n let overrides = {\n gasLimit: 120000,\n }\n approve(library, account, amountInWei)\n .then(async (results) => {\n if (results) {\n const contr = new Contract(CONTRACT_ADDRESS, contrInterface, library.getSigner(account))\n const tx = await contr.burn(amountInWei, overrides)\n const recpt = await tx.wait()\n txSuccess(recpt, toast, refreshMons)\n txFail(recpt, toast)\n } else {\n toast.error(`Error in approving`)\n }\n setDisableBuyItem(false)\n })\n .catch((e) => {\n toast.error(`Error: ${e?.message}`)\n setDisableBuyItem(false)\n })\n }\n\n // Components\n // div that holds the name and id of each Cryptomon\n const nameDiv = (mon) => {\n return (\n <div>\n <label className=\"monName\">{names[mon?.species]}</label>\n <label className=\"\" style={{ float: 'right' }}>\n {'ID: ' + mon?.id}\n </label>\n </div>\n )\n }\n\n // Function that returns the style of the background image according to Cryptomons' type\n const bgStyle = (Type) => ({\n backgroundImage: 'url(' + bg[Type] + ')',\n backgroundSize: '210px 240px',\n })\n\n // div that holds the images (Cryptomon image and background image) of a Cryptomon\n const imgDiv = (mon) => {\n return (\n <div className=\"monBox\" style={bgStyle(mon?.monType)}>\n <img className=\"monImg\" src={MonImages[`${parseInt(mon?.species) + 1}`]} alt={mon?.species} />\n </div>\n )\n }\n\n // div that holds the stats of a Cryptomon\n const statDiv = (mon) => {\n return (\n <div className=\"stat-area\">\n <div className=\"stat-line\">\n <label className=\"stat-label\">Hp: </label>\n <StatBar percentage={(mon?.hp * 100) / 140} />\n </div>\n <div className=\"stat-line\">\n <label className=\"stat-label\">Attack: </label>\n <StatBar percentage={(mon?.atk * 100) / 140} />\n </div>\n <div className=\"stat-line\">\n <label className=\"stat-label\">Defense: </label>\n <StatBar percentage={(mon?.def * 100) / 140} />\n </div>\n <div className=\"stat-line\">\n <label className=\"stat-label\">Speed: </label>\n <StatBar percentage={(mon?.speed * 100) / 140} />\n </div>\n </div>\n )\n }\n\n // Create the div with add for sale button\n const addForSaleDiv = (mon, value) => {\n return (\n <div className=\"selling-div\">\n <label className=\"add-for-sale-label\">Set creatures price:</label>\n <input type=\"number\" className=\"add-for-sale-input\" value={value} onChange={(e) => handleChange(mon?.id, e)} />\n {isAddForSaleLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => addForSale(mon?.id, value)}\n >\n Add for sale\n </button>\n )}\n </div>\n )\n }\n\n // Create the div with remove from sale button\n const removeFromSaleDiv = (mon) => {\n return (\n <div className=\"selling-div\">\n <label className=\"remove-from-sale-label\">\n Price:\n <br />\n {formatUnits(mon?.price)}\n </label>\n {isRemoveFromSaleLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => removeFromSale(mon?.id)}\n >\n Remove from sale\n {isRemoveFromSaleLoading && <Spinner color=\"#000\" />}\n </button>\n )}\n </div>\n )\n }\n\n // Create the div with buy button\n const buyDiv = (mon) => {\n return (\n <div className=\"buying-div\">\n <div className=\"sale-price\">\n Price:\n <br />\n {formatUnits(mon?.price, 18)}\n </div>\n <div className=\"sale-owner\">Creature Owner: {mon?.owner} </div>\n {isBuyMonLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"sale-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyMon(mon?.id, mon?.price)}\n >\n Buy\n </button>\n )}\n </div>\n )\n }\n\n // Create the div with breed choice 1, choice 2 buttons\n const breedDiv = (mon) => {\n return (\n <div className=\"breed-choice-div\">\n <button\n className=\"br-Choice-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => {\n setBreedChoice1(mon?.id)\n }}\n >\n Choice 1\n </button>\n <button\n className=\"br-Choice-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => {\n setBreedChoice2(mon?.id)\n }}\n >\n Choice 2\n </button>\n </div>\n )\n }\n\n const breedOption = (breedchoice) => {\n if (breedchoice === null) {\n return (\n <div className=\"mon\">\n <figure className=\"my-figure\">\n <figcaption>\n <div className=\"monBox\">\n {' '}\n <img className=\"monImg\" src={MonImages['0']} alt={'empty'} />\n </div>\n </figcaption>\n </figure>\n </div>\n )\n } else {\n return cryptomons\n .filter((mon) => mon.id === breedchoice)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {imgDiv(mon)}\n <figcaption></figcaption>\n </figure>\n </div>\n </React.Fragment>\n ))\n }\n }\n\n // div with users Cryptomons\n const myCryptomonsDiv = myCryptomons\n .filter((mon) => !mon.forSale)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n {addForSaleDiv(mon, value)}\n </div>\n </React.Fragment>\n ))\n\n // div with user's Cryptomons that are for sale\n const forSaleCryptomons = myCryptomons\n .filter((mon) => mon.forSale)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n {removeFromSaleDiv(mon)}\n </div>\n </React.Fragment>\n ))\n\n // div with Cryptomons available for buy to the user\n const buyCryptomons = otherCryptomons\n .filter((mon) => mon.forSale)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n {buyDiv(mon)}\n </div>\n </React.Fragment>\n ))\n\n // div with user's Cryptomons that can be used for breeding\n const forBreedCryptomons = myCryptomons\n .filter((mon) => !mon.forSale)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n {breedDiv(mon)}\n </div>\n </React.Fragment>\n ))\n\n const cond = (mon) =>\n (mon.owner.toString().toLowerCase() === account?.toString()?.toLowerCase() && !mon.forSale) ||\n (mon.sharedTo.toString().toLowerCase() === account?.toString()?.toLowerCase() &&\n mon.owner.toString().toLowerCase() !== account?.toString()?.toLowerCase())\n\n // div with user's Cryptomons that can be used to fight with\n const forFightWithCryptomons = cryptomons.filter(cond).map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n <div className=\"fight-choice-div\">\n <button\n className=\"fight-Choice-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => {\n setFightChoice1(mon.id)\n }}\n >\n Choice 1\n </button>\n </div>\n </div>\n </React.Fragment>\n ))\n\n // div with Cryptomons that user can fight against\n const forFightAgainstCryptomons = otherCryptomons\n .filter((mon) => !mon.forSale && mon.sharedTo.toLowerCase() !== account?.toString().toLocaleLowerCase())\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n <div className=\"fight-choice-div\">\n <button\n className=\"fight-Choice-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => {\n setFightChoice2(mon.id)\n }}\n >\n Choice 2\n </button>\n </div>\n </div>\n </React.Fragment>\n ))\n\n // div with user's shared Cryptomons\n const sharedByMe = myCryptomons\n .filter((mon) => mon.sharedTo.toLowerCase() !== account?.toString().toLocaleLowerCase() && !mon.forSale)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n <div className=\"sharing-div\">\n <div className=\"shareTo-owner\">Shared to address: {mon.sharedTo} </div>\n {isStopSharingLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"stop-sharing-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => stopSharing(mon.id)}\n >\n Stop sharing\n </button>\n )}\n </div>\n </div>\n </React.Fragment>\n ))\n\n // div with Cryptomons shared to the user\n const sharedToMe = otherCryptomons\n .filter((mon) => mon.sharedTo === account)\n .map((mon) => (\n <React.Fragment key={mon.id}>\n <div className=\"mon\">\n <figure className=\"my-figure\">\n {nameDiv(mon)}\n {imgDiv(mon)}\n <figcaption>{statDiv(mon)}</figcaption>\n </figure>\n <div className=\"sharing-div\">\n <label className=\"shared-owner\">Creature Owner: {mon.owner} </label>\n {isStopSharingLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"stop-sharing-btn rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => stopSharing(mon.id)}\n >\n Stop sharing\n </button>\n )}\n </div>\n </div>\n </React.Fragment>\n ))\n\n // Function that does all the rendering of the application\n return (\n // Creation of the different tabs of the UI\n <div className=\"rpgui-content\">\n <ToastContainer />\n\n <div className=\"AppTitle\">\n <div className=\"row\" style={{ maxWidth: '100%' }}>\n <div className=\"column title-column col-lg-3 col-sm-12\">\n <img src={MonImages['favicon16x16']} alt=\"lokian-logo\" /> <span>L O K I A N </span>\n </div>\n\n <div className=\"column user-info-column col-lg-3 col-sm-12\">\n {/* ERC20, LOKs */}\n <span className=\"rpgui-container framed-grey\">\n {`${Math.round(Number(tokenBalance) * 1e4) / 1e4 || '0'} LOKs `}{' '}\n </span>\n </div>\n\n <div className=\"column wallet-info-column col-lg-6 col-sm-12\">\n <div className=\"row wallet-buttons\">\n {/* wallet logout */}\n <div className={`column wallet-column ${active ? 'col-lg-3' : ''} col-sm-12`}>\n {(active || error) && (\n <button\n className=\"rpgui-button\"\n onClick={() => {\n deactivate()\n setCryptomons([])\n setMyCryptomons([])\n setOtherCryptomons([])\n setWinner(null)\n setRounds(null)\n setValue(0)\n }}\n >\n Logout\n </button>\n )}\n </div>\n {/* wallet info */}\n {Object.keys(connectorsByName).map((name) => {\n const currentConnector = connectorsByName[name]\n const activating = currentConnector === activatingConnector\n const connected = currentConnector === connector\n const disabled = !triedEager || !!activatingConnector || connected || !!error\n\n return (\n <div className={`column wallet-column col-lg-${active ? '9' : '12'} col-sm-12`}>\n <button\n className=\"rpgui-button golden\"\n type=\"button\"\n style={{\n fontSize: '20px',\n paddingTop: '14px',\n width: '100%',\n }}\n onClick={() => {\n setActivatingConnector(currentConnector)\n activate(currentConnector)\n }}\n disabled={disabled}\n key={name}\n >\n {activating && <Spinner color={'black'} style={{ height: '25%', marginLeft: '-1rem' }} />}\n <Account />\n <div style={{ display: 'none' }}>{name}</div>\n {!account ? 'Connect Wallet' : ''}\n </button>\n </div>\n )\n })}\n </div>\n </div>\n </div>\n <div className=\"row\">\n <div className=\"column user-info-column col-lg-12 col-sm-12\">\n {/* Network Errors */}\n {!!error && (\n <h4 className=\"rpgui-container framed-golden-2\" style={{ marginTop: '1rem', marginBottom: '0' }}>\n {getErrorMessage(error)}\n </h4>\n )}\n </div>\n </div>\n </div>\n\n <Tabs defaultActiveKey=\"myCryptomons\" id=\"uncontrolled-tab-example\">\n <Tab className=\"x\" eventKey=\"myCryptomons\" title=\"My Creatures\">\n <div className=\"p1\">Your Entries</div>\n {myCryptomonsDiv}\n </Tab>\n <Tab eventKey=\"forSale\" title=\"My Shop\">\n <div className=\"p1\">My Shop</div>\n {forSaleCryptomons}\n </Tab>\n <Tab eventKey=\"buyCryptomons\" title=\"Marketplace\">\n {buyCryptomons}\n </Tab>\n <Tab eventKey=\"breedCryptomons\" title=\"Breed\">\n <div className=\"p1\">Breed</div>\n <div className=\"breeding-area\">\n {breedOption(breedChoice1)}\n {breedOption(breedChoice2)}\n {isBreedMonLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ width: '420px' }}\n onClick={() => breedMons(breedChoice1, breedChoice2)}\n >\n Breed choosen creatures\n </button>\n )}\n </div>\n <br />\n {forBreedCryptomons}\n </Tab>\n <Tab eventKey=\"fight\" title=\"Arena\">\n <div className=\"p1\">V S</div>\n <div className=\"fighting-area\">\n {breedOption(fightChoice1)}\n {breedOption(fightChoice2)}\n\n <label className=\"winner-label\">\n And the winner is...{' '}\n {fightTxDone ? names[cryptomons.find((mon) => mon.id?.toString() === winner?.toString())?.species] : ''}\n {!winner || winner === 12345678911 ? 'still unknown' : ''}\n {winner === 12345678910 ? \"no one, it's a tie\" : ''}\n </label>\n\n {fightTxDone && winner !== 12345678910 ? (\n <>\n <br />\n <label className=\"winner-label\">Winning creature's Id: {winner}</label>\n <br />\n <label className=\"winner-label\">Rounds the fight lasted: {rounds}</label>\n <br />\n\n {!fightTxDone && rewards === 0 && !winner ? (\n ''\n ) : (\n <label className=\"winner-label\">{rewards === 0 ? '' : `You have won ${rewards} LOKs!`}</label>\n )}\n </>\n ) : (\n ''\n )}\n\n {disableFightBtn ? (\n <Spinner color=\"gray\" style={{ marginLeft: '50%', marginRight: 'auto', padding: '8px' }} />\n ) : (\n <button\n id=\"fight-btn\"\n className=\"rpgui-button\"\n type=\"button\"\n onClick={() => {\n setWinner(null)\n setRounds(null)\n setFightTxDone(false)\n setRewards(0)\n fight(fightChoice1, fightChoice2)\n }}\n disabled={disableFightBtn}\n >\n Fight with choosen creatures\n </button>\n )}\n </div>\n <div className=\"fight-mons-area\">\n <div className=\"fightWith-area\">\n <div className=\"p2\">Your Creatures</div>\n {forFightWithCryptomons}\n </div>\n <div className=\"fightAgainst-area\">\n <div className=\"p2\">Opponent Creatures</div>\n {forFightAgainstCryptomons}\n </div>\n </div>\n </Tab>\n <Tab eventKey=\"share\" title=\"Share\">\n <div className=\"p1\">Sharing Management</div>\n <div className=\"sharing-area\">\n <div className=\"form-line\">\n <label className=\"form-label\">Creature Id:</label>\n <input className=\"form-input\" value={shareId} onChange={(e) => handleShareId(e)} />\n </div>\n <div className=\"form-line\">\n <label className=\"form-label\">Share to address:</label>\n <input className=\"form-input\" value={shareAddress} onChange={(e) => handleShareAddress(e)} />\n </div>\n <div className=\"form-line\">\n {isShareLoading ? (\n <button className=\"rpgui-button\" type=\"button\" style={{ width: '100%' }}>\n <Spinner color=\"#000\" />\n </button>\n ) : (\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => startSharing(shareId, shareAddress)}\n >\n Share\n </button>\n )}\n </div>\n </div>\n {sharedByMe}\n </Tab>\n <Tab eventKey=\"sharedToMe\" title=\"Shared To Me\">\n <div className=\"p1\">Shared To You</div>\n {sharedToMe}\n </Tab>\n <Tab eventKey=\"token\" title=\"Token\">\n <div className=\"p1\">Your money</div>\n <div className=\"p1\" style={{ padding: '12px' }}>\n {tokenBalance} Lokians\n </div>\n <br />\n <br />\n <div className=\"p1\">\n Your items\n <div style={{ marginLeft: '45%', marginRight: 'auto' }}>\n <div className=\"row\">\n <div className=\"column\">\n {!swords ? <div className=\"rpgui-icon weapon-slot\"></div> : <div className=\"rpgui-icon sword\"></div>}\n {!shields ? (\n <div className=\"rpgui-icon shield-slot\"></div>\n ) : (\n <div className=\"rpgui-icon shield\"></div>\n )}\n {healingPotions || manaPotions || magicPotions ? (\n <div className=\"rpgui-icon potion-red\"></div>\n ) : (\n <div className=\"rpgui-icon potion-slot\"></div>\n )}\n </div>\n </div>\n </div>\n <br />\n <div style={{ marginLeft: '40%', marginRight: 'auto' }}>\n <div className=\"row\">\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>\n <p>You have {`${swords}`} swords!</p>\n <p>You have {`${shields}`} shields!</p>\n <p>You have {`${healingPotions}`} healing potions!</p>\n <p>You have {`${manaPotions}`} mana potions!</p>\n <p>You have {`${magicPotions}`} magic potions!</p>\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"rpgui-container framed-grey\">\n <div className=\"p1\">Buy somethin (NFT)</div>\n <div className=\"p1\">note: if transaction fails, set gas fees above 100k</div>\n <div className=\"sharing-area\">\n <span>\n <div className=\"rpgui-icon sword\"></div> A Sword (500 Loks)\n </span>\n <div className=\"form-line with-buy-item\">\n <label className=\"form-label\">Amount</label>\n <input\n className=\"form-input\"\n placeholder=\"0\"\n value={buyItemAmount}\n onChange={(e) => handleBuyItemAmount(e)}\n />\n </div>\n <div className=\"form-line with-buy-item\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyItem(buyItemAmount, '500', '3')}\n disabled={disableBuyItemBtn}\n >\n Buy\n </button>\n </div>\n </div>\n\n <div className=\"sharing-area\">\n <span>\n <div className=\"rpgui-icon shield\"></div> A Shield (500 Loks)\n </span>\n <div className=\"form-line with-buy-item\">\n <label className=\"form-label\">Amount</label>\n <input\n className=\"form-input\"\n placeholder=\"0\"\n value={buyItemAmount}\n onChange={(e) => handleBuyItemAmount(e)}\n />\n </div>\n <div className=\"form-line with-buy-item\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyItem(buyItemAmount, '500', '4')}\n disabled={disableBuyItemBtn}\n >\n Buy\n </button>\n </div>\n </div>\n\n <div className=\"sharing-area\">\n <span>\n <div className=\"rpgui-icon potion-red\"></div>A Healing Potion (50 Loks)\n </span>\n <div className=\"form-line with-buy-item\">\n <label className=\"form-label\">Amount</label>\n <input\n className=\"form-input\"\n placeholder=\"0\"\n value={buyItemAmount}\n onChange={(e) => handleBuyItemAmount(e)}\n />\n </div>\n <div className=\"form-line with-buy-item\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyItem(buyItemAmount, '50', '0')}\n disabled={disableBuyItemBtn}\n >\n Buy\n </button>\n </div>\n </div>\n\n <div className=\"sharing-area\">\n <span>\n <div className=\"rpgui-icon potion-blue\"></div> A Mana Potion (50 Loks)\n </span>\n <div className=\"form-line with-buy-item\">\n <label className=\"form-label\">Amount</label>\n <input\n className=\"form-input\"\n placeholder=\"0\"\n value={buyItemAmount}\n onChange={(e) => handleBuyItemAmount(e)}\n />\n </div>\n <div className=\"form-line with-buy-item\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyItem(buyItemAmount, '50', '1')}\n disabled={disableBuyItemBtn}\n >\n Buy\n </button>\n </div>\n </div>\n\n <div className=\"sharing-area\">\n <span>\n <div className=\"rpgui-icon potion-green\"></div> A Magic Potion (50 Loks)\n </span>\n <div className=\"form-line with-buy-item\">\n <label className=\"form-label\">Amount</label>\n <input\n className=\"form-input\"\n placeholder=\"0\"\n value={buyItemAmount}\n onChange={(e) => handleBuyItemAmount(e)}\n />\n </div>\n <div className=\"form-line with-buy-item\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => buyItem(buyItemAmount, '50', '2')}\n disabled={disableBuyItemBtn}\n >\n Buy\n </button>\n </div>\n </div>\n </div>\n\n <div className=\"rpgui-container framed-grey\">\n <div className=\"p1\">Give to the skeleton people (burn token)</div>\n <div className=\"p1\">note: if transaction fails, set gas fees above 100k</div>\n <div className=\"skellies\">\n <img className=\"monImg\" src={MonImages['skelly']} alt=\"skeleton-people-1\" />\n <img className=\"monImg\" src={MonImages['skelly2']} alt=\"skeleton-people-1\" />\n <img className=\"monImg\" src={MonImages['skellyrip']} alt=\"skeleton-people-1\" />\n </div>\n <div className=\"sharing-area\">\n <div className=\"form-line with-burn\">\n <label className=\"form-label\">Amount</label>\n <input className=\"form-input\" placeholder=\"0\" value={burnAmount} onChange={(e) => handleBurn(e)} />\n </div>\n <div className=\"form-line with-burn\">\n <button\n className=\"rpgui-button\"\n type=\"button\"\n style={{ float: 'right' }}\n onClick={() => burn(burnAmount)}\n disabled={disableBuyItemBtn}\n >\n Give\n </button>\n </div>\n </div>\n </div>\n </Tab>\n </Tabs>\n </div>\n )\n}\n\nexport default App\n","E:\\Lokian.eth\\src\\utils\\txFail.js",[],["58","59"],"E:\\Lokian.eth\\src\\utils\\txSuccess.js",[],"E:\\Lokian.eth\\src\\wallet\\connectors.ts",[],"E:\\Lokian.eth\\src\\wallet\\hooks.ts",["60"],"import { useState, useEffect } from 'react'\r\nimport { useWeb3React } from '@web3-react/core'\r\n\r\nimport { injected } from './connectors'\r\n\r\nexport function useEagerConnect() {\r\n const { activate, active } = useWeb3React()\r\n \r\n const [tried, setTried] = useState(false)\r\n \r\n useEffect(() => {\r\n injected.isAuthorized().then((isAuthorized: boolean) => {\r\n if (isAuthorized) {\r\n activate(injected, undefined, true).catch(() => {\r\n setTried(true)\r\n })\r\n } else {\r\n setTried(true)\r\n }\r\n })\r\n }, []) // intentionally only running on mount (make sure it's only mounted once :))\r\n \r\n // if the connection worked, wait until we get confirmation of that to flip the flag\r\n useEffect(() => {\r\n if (!tried && active) {\r\n setTried(true)\r\n }\r\n }, [tried, active])\r\n \r\n return tried\r\n }\r\n\r\n export function useInactiveListener(suppress: boolean = false) {\r\n const { active, error, activate } = useWeb3React()\r\n \r\n useEffect((): any => {\r\n const { ethereum } = window as any\r\n if (ethereum && ethereum.on && !active && !error && !suppress) {\r\n const handleConnect = () => {\r\n console.log(\"Handling 'connect' event\")\r\n activate(injected)\r\n }\r\n const handleChainChanged = (chainId: string | number) => {\r\n console.log(\"Handling 'chainChanged' event with payload\", chainId)\r\n activate(injected)\r\n }\r\n const handleAccountsChanged = (accounts: string[]) => {\r\n console.log(\"Handling 'accountsChanged' event with payload\", accounts)\r\n if (accounts.length > 0) {\r\n activate(injected)\r\n }\r\n }\r\n const handleNetworkChanged = (networkId: string | number) => {\r\n console.log(\"Handling 'networkChanged' event with payload\", networkId)\r\n activate(injected)\r\n }\r\n \r\n ethereum.on('connect', handleConnect)\r\n ethereum.on('chainChanged', handleChainChanged)\r\n ethereum.on('accountsChanged', handleAccountsChanged)\r\n ethereum.on('networkChanged', handleNetworkChanged)\r\n \r\n return () => {\r\n if (ethereum.removeListener) {\r\n ethereum.removeListener('connect', handleConnect)\r\n ethereum.removeListener('chainChanged', handleChainChanged)\r\n ethereum.removeListener('accountsChanged', handleAccountsChanged)\r\n ethereum.removeListener('networkChanged', handleNetworkChanged)\r\n }\r\n }\r\n }\r\n }, [active, error, suppress, activate])\r\n }","E:\\Lokian.eth\\src\\StatBar.tsx",[],"E:\\Lokian.eth\\src\\components\\Spinner.tsx",[],"E:\\Lokian.eth\\src\\sprites-copy\\index.js",[],"E:\\Lokian.eth\\src\\sprites\\index.js",[],["61","62"],{"ruleId":"63","replacedBy":"64"},{"ruleId":"65","replacedBy":"66"},{"ruleId":"67","severity":1,"message":"68","line":12,"column":1,"nodeType":"69","endLine":18,"endColumn":2},{"ruleId":"70","severity":1,"message":"71","line":304,"column":6,"nodeType":"72","endLine":304,"endColumn":38,"suggestions":"73"},{"ruleId":"70","severity":1,"message":"71","line":320,"column":6,"nodeType":"72","endLine":320,"endColumn":60,"suggestions":"74"},{"ruleId":"70","severity":1,"message":"71","line":365,"column":6,"nodeType":"72","endLine":365,"endColumn":37,"suggestions":"75"},{"ruleId":"63","replacedBy":"64"},{"ruleId":"65","replacedBy":"66"},{"ruleId":"70","severity":1,"message":"76","line":21,"column":8,"nodeType":"72","endLine":21,"endColumn":10,"suggestions":"77"},{"ruleId":"63","replacedBy":"78"},{"ruleId":"65","replacedBy":"79"},"no-native-reassign",["80"],"no-negated-in-lhs",["81"],"import/no-anonymous-default-export","Unexpected default export of anonymous function","ExportDefaultDeclaration","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'refreshMons'. Either include it or remove the dependency array.","ArrayExpression",["82"],["83"],["84"],"React Hook useEffect has a missing dependency: 'activate'. Either include it or remove the dependency array.",["85"],["80"],["81"],"no-global-assign","no-unsafe-negation",{"desc":"86","fix":"87"},{"desc":"88","fix":"89"},{"desc":"90","fix":"91"},{"desc":"92","fix":"93"},"Update the dependencies array to be: [activatingConnector, connector, refreshMons]",{"range":"94","text":"95"},"Update the dependencies array to be: [account, library, disableBuyItemBtn, disableFightBtn, refreshMons]",{"range":"96","text":"97"},"Update the dependencies array to be: [account, library, fightTxDone, refreshMons]",{"range":"98","text":"99"},"Update the dependencies array to be: [activate]",{"range":"100","text":"101"},[8596,8628],"[activatingConnector, connector, refreshMons]",[8900,8954],"[account, library, disableBuyItemBtn, disableFightBtn, refreshMons]",[10159,10190],"[account, library, fightTxDone, refreshMons]",[572,574],"[activate]"]