Ethereum Boilerplate Questions

Were you able to figure something out?
I’ve got the same error.

Dear Ivan, Good morning and with hope you are well i thought to reach you and the team with an open and candid comment, and with hope that you might be able to assist me in addressing something I find rather troubling.

First I want to tell you that for me you personally have been a great inspiration and one of the very first reasons I have ever even stepped foot inside the development space - in defi and in learning everything I possibly could about crypto and block chain in general.

For me, I have followed many of your courses, and watched almost every video youve ever created, yes, needless to say, im a pretty big fan.

To the question I had, I wanted to ask for some help, my latest project involves the Ethereum boilerplate Moralis has developed and i cannot tell you how excited I was to find this among the great tools your team is developing. I jumped straight away into it…

The implementation was straightforward and easily built as really just a few lines of code in visual studio and wala… just like you always said, in just a few lines of code… you too can be a rockstar :).

What I am hoping to find out, if it is at all possible that you guys can offer some simple insight… even the git repository describes the new updated version of the boilerplate, feat. Easy add custom tokens… and to wit there is even a code blurb given on the read me description of the few lines of code you need to implement, in adding your own custom token to the Dex…

Options:

chain (optional): network. Available: Ethereum (“eth”), Binance Smart Chain (“bsc”), Polygon (“polygon”)
customTokens (optional): object with custom tokens. You can see the example below.
<DEX chain="eth" />
// Adding custom tokens

const customTokens = {
  "0x2180F5cC1ddf117640963AE91868948bd3EF6838": {
    address: "0x2180F5cC1ddf117640963AE91868948bd3EF6838",
    decimals: 9,
    logoURI:
      "https://assets.coingecko.com/coins/images/20985/small/_VoQPDDs_400x400.jpg?1638168643",
    name: "AscensionArcade",
    symbol: "AAT",
  },
};

<DEX chain="eth" customTokens={customTokens} />;

However what isnt clear is where is this code supposed to be added, i have read and re read almost every forum thread asking this question and it seems to never be answered, simply left in the hands of a couple of frankenstein hackers who are throwing out all sorts of incomplete and half answers and explanations that have no direction, where in the end only petering off to two guys who seem to have figured it out 90 percent and talking to themselves and about how great they are… but share no solution and leave the question without an answer.

My question is only the product is presented as Feat: Easily add your own custom token, yet there is no explanation on how… and no one seems to answer when asked…

In the end im basically begging for a simple answer as it would be of great help to know whether or not what im trying to achieve is even feasible with the Dex in the boilerplate.

It already misses the most important features a dex would want, ie a search bar to enter a token address and find the token, nor does it allow to set slippage, and in the end… seems that its not easy at all to do what it was supposed to be easy to do to begin with - in adding your custom token to the Dex… In my case im trying to add a newly deployed BSC Token - to the token list - either hard coded to the top or to show up in the list at all… I can already see it when searching for it using the 1inch swap on their site, so it is discoverable and pulls up when searched there, im hoping that i can do something remotely close to it on the dex in this boilerplate.

Please help me guys… I already am a customer and have a moralis server plan and am looking to simply complete this build. I would be honored and thankful for any reply you might offer. With many thanks in advance. and kind regards. Deus.

when i try to list an item on ropsten and mumbai,the approval works fine but the final listing doesnt work,the error message i get in my metamask is that ‘this contract doesnt support this transaction insight at this time’
Also,my moralis dashboard synced to listen to the contract isnt listening to it.
what could be the problem.aside from the moralis dapp provider page,is there any other place i need to paste the contract adress in theboilerplate

@Yomoo is it possible that you might direct me to an answer regarding how to add my token to the ethereum boiler plate dex list of supported tokens. Nay help you can provide that will resolve this based on your most recent git for the boilerplate would be highly appreciated.

Hi there,

Can any one help me with this error, or at least guide me where to look?
Thanks.

1 Like

I updated react, react-moralis and moralis trying to solve a 401 error while fetching NFTs, and I ended up with this:

TypeError: Moralis.onAccountsChanged is not a function
(anonymous function)
src/providers/MoralisDappProvider/MoralisDappProvider.js:14
  11 |   setChainId(chain);
  12 | });
  13 | 
> 14 | Moralis.onAccountsChanged(function (address) {
     | ^  15 |   setWalletAddress(address[0]);
  16 | });
  17 | // eslint-disable-next-line react-hooks/exhaustive-deps

TypeError: Moralis.onAccountsChanged is not a function
(anonymous function)
src/providers/MoralisDappProvider/MoralisDappProvider.js:14
  11 |   setChainId(chain);
  12 | });
  13 | 
> 14 | Moralis.onAccountsChanged(function (address) {
     | ^  15 |   setWalletAddress(address[0]);
  16 | });
  17 | // eslint-disable-next-line react-hooks/exhaustive-deps

Console logs:

./node_modules/magic-sdk/dist/es/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
./node_modules/magic-sdk/dist/es/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
./node_modules/moralis/lib/browser/Web3Connector/Web3AuthConnector.js
Module not found: Can’t resolve ‘@web3auth/web3auth’ in ‘/home/lautaro/nft/ethereum-boilerplate/node_modules/moralis/lib/browser/Web3Connector’

The post which explains how to solve it isn’t clear about what to do.

I also had an issue with the Wallet. It would crash on me after navigating from one page to another. I looked into it and in my case my native balance and my ERC-20 balance was zero for the wallet I was authenticated with.
So I opened up the AssetSelector to see whether I could edit it.
I added the || 0 as a workaround, seemed to work in my case.

{parseFloat(
Moralis?.Units?.FromWei(item.balance || 0, item.decimals),
)?.toFixed(6)}
1 Like

Yeah, I did something similar to the components I was facing issues with and it seemed to work.

Thanks a lot for taking the time to respond though, I appreciate it.

Hi,

I was working with ethereum boilerplate for my upcoming project.
Just wanted to know if there’s any hook for ERC20Approval like there is ERC20Transfers.

Thanks.

How can I use this menu guys, I can’t load the assets for the transfer.

Can anyone help me with this? I have touched the boilerplate (besides following the steps on the YT tutorial)
ERROR in src\components\Contract\Contract.jsx
Line 90:34: Unsafe usage of optional chaining. If it short-circuits with ‘undefined’ the evaluation will throw TypeError no-unsafe-optional-chaining


/*eslint no-unsafe-optional-chaining: "error"*/

              for (let method of contract?.abi) {

                if (method.name !== name) continue;

                console.log(method);

                if (method.stateMutability === "view") isView = true;

              }
1 Like

Have the same problem, and I did not do anything on the boilerplate yet…it’s just there from the beginning

Hey, found something.
this command should clear your ESlint cache, it worked like a charm for me
rm -rf node_modules/.cache/eslint-loader1~

You need assets in your wallet in order to show up here.

Did you mean is login, if it I had login in.
In the demo site I still see it show up…

Did anyone meet this error? I can’t make a transaction when listing a NFT. It will pending until the transaction failed when I keep trying to confirm the transaction .
image

did you approved it?

Hi all, how can I retrieve information from a contract without the user being connected to their wallet.

And how can I retrieve them automatically at startup?

I once had this error when I tried to list an NFT that is not my wallet or trying to buy an NFT that is already brought by someone.

You might also see an very high gas fees.

oh I see, its can relate to the gas fees or my nft problem.
I will check it out.

Thank you