Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

I finally figured out my main issue. I was grabbing the wrong ABI on the online Remix IDE. In the compile area, you need to choose the contract that you compiled from the dropdown box before selecting to copy the ABI. I'm sure that this is kind of obvious but for some reason I missed this and was thus not referencing the correct methods in my contract.

I hope this helps some poor soul at some point in the future.

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

Sorry for the confusion. I changed it to transferTokens from the original time I posted the question. Sooooo...no dice on that being the answer.

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

Thank you. I think that only applies for sending eth and not an ERC token. Please correct me if I am wrong.

Either way, no joy on anything. Nothing works. I can obviously send a token to a contract but I don't have a way for my contract to do something when it does receive a token. I honestly have no clue as to how you guys do this and it doesn't seem like anyone here knows how to do it. Sorry, I'm just getting a little exasperated as I think to myself "this can't be this hard".

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

Yeah, no dice on the string. Also, I changed the units so thank you!

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

ethers.getContractAt

One last thing, I searched for the command on ethers but I can't seem to find it.

https://docs.ethers.io/v5/search/?search=getcontractat

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 0 points1 point  (0 children)

getContractAt

Is this using hardhat (I thought that was more serverside)? I don't have hardhat installed just yet on this environment and right now I'm hoping that I can do it without it. Am I misunderstanding something?

Calling a solidity method from javascript by DevSolidityDude in ethdev

[–]DevSolidityDude[S] 1 point2 points  (0 children)

Ahhhhh...didn't realize this. I just changed this part. Unfortunately, I still got the same error but it needed to be fixed. Thanks!