Hello Moralis Community,
I have been trying to implement moralis into an existing create-react-app repo that is using TypeScript. It is not the boilerplate your are guys using.
The moment I do yarn add moralis
I get the following error:
Argument of type 'import("/Users/btcstorage/WebstormProjects/myNFTProject/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface").Interface' is not assignable to parameter of type 'import("/Users/btcstorage/WebstormProjects/myNFTProject/node_modules/@ethersproject/abi/lib/interface").Interface'.
Types of property 'fragments' are incompatible.
The type 'readonly Fragment[]' is 'readonly' and cannot be assigned to the mutable type 'Fragment[]'. TS2345
"dependencies": {
"@binance-chain/bsc-connector": "^1.0.0",
"@ethersproject/experimental": "^5.0.1",
"@pancakeswap/sdk": "^2.3.2",
"@pancakeswap/uikit": "^0.50.1",
"@reduxjs/toolkit": "^1.5.0",
"@types/multicodec": "^1.0.0",
"@types/node": "^13.13.5",
"@types/qs": "^6.9.6",
"@types/react": "^17.0.5",
"@types/react-dom": "^17.0.4",
"@types/react-router-dom": "^5.1.5",
"@types/react-window": "^1.8.3",
"@types/styled-components": "^5.1.7",
"@uniswap/token-lists": "^1.0.0-beta.19",
"@uniswap/v2-core": "^1.0.0",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@web3-react/core": "^6.1.9",
"@web3-react/injected-connector": "^6.0.7",
"@web3-react/walletconnect-connector": "^6.2.4",
"ajv": "^6.12.3",
"bignumber.js": "^9.0.0",
"canvas-confetti": "^1.3.3",
"cids": "^1.0.0",
"date-fns": "^2.21.3",
"easymde": "^2.15.0",
"ethers": "^5.1.4",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.21",
"moralis": "^0.0.176",
"multicodec": "^2.0.0",
"multihashes": "^3.0.1",
"node-fetch": "^2.6.1",
"qs": "^6.9.4",
"react": "^17.0.1",
"react-async-hook": "^4.0.0",
"react-countup": "^4.3.3",
"react-datepicker": "^4.2.1",
"react-dom": "^17.0.1",
"react-feather": "^2.0.8",
"react-helmet-async": "^1.0.9",
"react-markdown": "^6.0.2",
"react-masonry-css": "^1.0.16",
"react-moralis": "^0.3.11",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.1",
"react-transition-group": "^4.4.1",
"react-tsparticles": "^1.35.1",
"react-window": "^1.8.6",
"redux-localstorage-simple": "^2.4.1",
"remark-gfm": "^1.0.0",
"split-grid": "^1.0.11",
"styled-components": "^5.3.0",
"swiper": "6.8.4",
"typescript": "^4.3.2"
},
npm view webpack version
5.65.0
yarn list webpack
warning Filtering by arguments is deprecated. Please use the pattern option instead.
ââ [email protected]
â ââ [email protected]
ââ [email protected]
This could be a versioning issue, right?
What I am trying to achieve is to make an API call from front-end asking for the following
x = await Moralis.Web3API.account.getNFTsForContract({âchainâ:âeth or bsc or polâ,âaddressâ:âuserWalletAddressâ,âtoken_addressâ:âcollectionContractAddressâ} )
In the repo we have custom hooks that are using
import { Interface, FunctionFragment } from '@ethersproject/abi'
and we are using the Interface like this:
function toCallState(
callResult: CallResult | undefined,
contractInterface: Interface | undefined,
...)
return useMemo(() => {
return toCallState(result, *contract?.interface*, fragment, currentBlock)
}, [result, contract, fragment, currentBlock])
The bold+italic shows where the TS error appears
What would you recommend I do.