Ethereum Boilerplate Questions

Thanks Ivan. I re-ran a ā€œyarn installā€ and then ā€œyarn startā€ and it opened up in local host but the live server in VSCode doesnā€™t work. Will you bring any burner wallets and in dapp faucets to the boilerplate like in scaffold eth? would be great to not worry about users/addresses or finding faucets online.

1 Like

binance smart chain not working in the boilerplate once i connect to binance smart chain the dex disappears how do i fix it

i got this error
PS C:\Users\User\Desktop\wff daps\ethereum-boilerplate-main> npx yarn install
yarn install v1.22.17
[1/4] Resolving packagesā€¦
[2/4] Fetching packagesā€¦
error Couldnā€™t find the binary git

1 Like

Hi @MarkyMarx we will add faucets :raised_hands:

Hi @kubkymberly

You need to set this info on settings

Hi @joaoalvesmarrucho. You can ignore the first message, but the second is a problem with Mumbai RPC. I suggest you to edit the src/helpers/networks.js config and change the Mumbai RPC to Speedy Node:
You need to change:

"0x13881": {
    chainId: 80001,
    chainName: "Mumbai",
    currencyName: "MATIC",
    currencySymbol: "MATIC",
    rpcUrl: "https://speedy-nodes-nyc.moralis.io/YOURSPEEDYNODE/polygon/mumbai",
    blockExplorerUrl: "https://mumbai.polygonscan.com/",
  },

https://docs.moralis.io/speedy-nodes/what-are-speedy-nodes

1 Like

Hello,
Iā€™m having this error after I cloned a fork of the Boilerplate:


I did follow all the steps: cloned, npm install, created .env with my app id and server url, npm start.
Whatā€™s weird is that the same project works for one but not for meā€¦
Updated the server too, same. Version issue maybeā€¦

1 Like

Hi @nadtn what if you try to provide appId and serverUrl directly to the index.js

2 Likes

Hi! It workedā€¦ :sweat_smile:
Thanks but why?

src\components\AddressInput.jsx
Line 14:6: React Hook useEffect has missing dependencies: ā€˜propsā€™ and ā€˜validatedAddressā€™. Either include them or remove the dependency array. However, ā€˜propsā€™ will change when any prop changes, so the preferred fix is to destructure the ā€˜propsā€™ object outside of the useEffect call and refer to those specific props inside useEffect react-hooks/exhaustive-deps

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

Hey @mejmerlin !

You can ignore these warnings. We will remove them in the next update. If you want to do it yourself
add

  // eslint-disable-next-line react-hooks/exhaustive-deps

into AddressInput.jsx located in src/components between line 13 and 14.

npm run devchain
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\User\OneDrive\Desktop\dapp/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ā€˜C:\Users\User\OneDrive\Desktop\dapp\package.jsonā€™
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2021-11-13T17_25_43_525Z-debug.log

What are you trying to dir sir ?

starting a local devchain and i stumble into this

npm run devchain
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\User\OneDrive\Desktop\dapp/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ā€˜C:\Users\User\OneDrive\Desktop\dapp\package.jsonā€™
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2021-11-13T17_25_43_525Z-debug.log

I see people having issues with npm and the boilerplate .

Clone the repo again and use
yarn install
Then
yarn run start

Web Bundling complete 19183ms
./node_modules/@ui-kitten/components/ui/input/input.component.js 105:38
Module parse failed: Unexpected token (105:38)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| this.webEventResponder = devsupport_1.WebEventResponder.create(this);
| this.focus = () => {

        this.textInputRef.current?.focus();

| };
| this.blur = () => {
./node_modules/@ui-kitten/components/ui/tab/tabBar.component.js 137:37
Module parse failed: Unexpected token (137:37)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| scrollToIndex(params) {

    this.tabIndicatorRef.current?.scrollToIndex(params);

| }
| scrollToOffset(params) {
./node_modules/@ui-kitten/components/ui/popover/popover.component.js 148:38
Module parse failed: Unexpected token (148:38)

is there any workaround to fix this?

Thank you for the great work

Hi @mrhigh3r

It looks like a problem because of the third-party library @ui-kitten . If you share your full code repo we will be able to check it

Intro

@MoralisTeam, thanks for creating this boilerplate. Iā€™m working on my first project as part of Chainlink hackathon, and your boilerplate has been most helpful.

Wanted to share an issue I ran into. Maybe it will help others, and wondering whatā€™s the ā€œrightā€ way to address the issue.

Details

I have a simple ERC1155 contract, and wanted to replace the MetaCoin example in boilerplate -> Contracts with my own. So I created an abi (using hardhat-abi-exporter), and then replicated most of what I saw in src/contracts/contractInfo.json.

It mostly worked. However I noticed that functions with array inputs didnā€™t work. For example, the standard balanceOf(address, uint256) worked, but balanceOfBatch(address[], uint256[]) suffered from 2 errors related to parameters that were arrays:

  1. The uint256[] was causing an ā€˜param.map is not a function errorā€™
  2. The address[] was causing an invalid argugment error

I tracked this down to node_modules/web3-eth-abi/lib/index.js the function is ABICoder.prototype.formatParam, and observed that:

  1. The code has regex to identify integer arrays, and attempts to process them. But it assumes the param IS an array, and calls param.map. The form input from Contracts UI is not an array, itā€™s a string. Here are code snippets:
// I'm snipping relevant code from ABICoder.prototype.formatParam
const paramTypeBytesArray = new RegExp(/^bytes([0-9]*)\[\]$/);
const paramTypeNumberArray = new RegExp(/^(u?int)([0-9]*)\[\]$/);

if (type.match(paramTypeBytesArray) || type.match(paramTypeNumberArray)) {
        return param.map(p => this.formatParam(type.replace('[]', ''), p));
    }
  1. The code had no awareness of address[], and was treating these as a string. When the call is evenutally made to the Contract, I suspect this invalid argument is triggered.

End

I temporarily confirmed / got around this issue by making some changes to web3-eth-abi code. I know this isnā€™t the right solution. But it did allow me to confirm the issue, and I was able to successfully call my contract functions that needed array inputs.

Iā€™m wondering if the Contract.jsx or some other ethereum-boilerplate code changes to better support arrays in Contracts UI. Apologies, Iā€™m new to React as well, and so donā€™t have an informed comment on this. Still trying to wrap my head around everything.

Thanks again team, Iā€™m really enjoying the Moralis features as I work on my hackathon project!

2 Likes

NFTs arenā€™t showing anymore. It worked fine until yesterday. I started again from scratch and still doesnā€™t work. Logs show the array is empty, so it doesnā€™t get any NFTs to begin with.

Hi @lautaro

Thank you for your patience :raised_hands:
There was a bug and it is already fixed. Pull the latest version and Happy BUIDLing :man_factory_worker:

1 Like