Ethereum Boilerplate Questions

customtoken2

Hey guys I added the code as per on the image to useinchDex.js but the token isn’t showing when I got to DEX section on my app. Is there something else I need to do/add?

Thanks for the help! :slight_smile:

It won’t come easy for you to copy something out of the boilerplate due to the way it’s structured, but what you can do is edit the boilerplate using it to build your project and customize it to your fit.

You need to just add your customTokens to the object of the result of the tokens returned before rendering the your modal or a view to display the tokens.

1 Like

I’ve run into some strange behavior with the useERC20Balances() function. I’ve cloned the latest boilerplate repo, and modified the ERC20Balance.jsx page to filter the results like:

- const { data: assets } = useERC20Balances(props);
+ const { data: assets } = useERC20Balances({address: "0x...12345", chain: "0x61"});

It works as expected on page load - the “assets” object contains just the token i am interested in, so i only get a single token displayed in the table (as expected).

However, if while on the page, you F5 or Ctrl+F5, the object becomes null, and the page doesn’t display any tokens - it’ll sit indefinitely with the Loading Skeleton being displayed.

Navigating to a different page and back again via the menu will cause it to work again. So the issues seems to only exist on users refreshing the page.

The original code with no filtering (props is an empty object) does not have this behavior. It functions correctly when Refreshing the page manually. So it seems that adding a filter on it is causing the change in behavior.

Browser: Chrome

Thanks in advance.

Hello there.
i want to use the Dex component, so after cloning the repository for ethereum boilerplate for react, i tried copying the the files and the still gave errors

Sorry i’m trying to achieve what you’ve achieved. I’m trying to use the Dex swap component, but errors. How can i achieve that with just copying the component

It won’t come easy for you to copy something out of the boilerplate due to the way it’s structured, but what you can do is edit the boilerplate using it to build your project and customize it to your fit.

@qudusayo :nigeria: Thanks.

But have you done anything related to it before. I sure need a solid help here

Working on one currently, yet to be completed. You can take a sneak peak at https://rdex.vercel.app/

Hello Guys, I am not getting the swap option in the moralis boilerplate DEX, I have installed the 1inch Plugin as well but I am not getting the option of Swap

After clicking on Switch to Eth I am getting this error, Can anyone Help Please??

Make sure all of your swap options are correct, and try setting static values. You can look at the base boilerplate code to compare with your own where it all works by default.

In your components section - contract/contractc.jsx in line 90, there is contract?.abi which needs to be defined, if I want to deploy it.
What contract are we talking about and what’s the solution for it, I keep running into an error:

Line 90:34: Unsafe usage of optional chaining. If it short-circuits with ‘undefined’ the evaluation will throw TypeError no-unsafe-optional-chaining.

Thx in advance Maurice

Try changing
for (let method of contract?.abi )
to
for (let method of contract?.abi ?? method)

Check this for reference

Using the latest Ethereum boilerplate might also resolve this.

1 Like

ok thx you, let me check that

It’s still the same issue, check the picture below.

Try with error suppression on the previous one

/*eslint no-unsafe-optional-chaining: "error"*/
for (let method of contract?.abi)
1 Like

it still tells me the contract is undefined. :sweat_smile:

That’s the last accepted fix for that error :sweat_smile:

Can you check if you are not missing any from here.

Did you happen to solve the error?

If not try this. I somehow recreated the error and adding this eslint comment cleared it.
// eslint-disable-next-line no-unsafe-optional-chaining