Erc20 front end problem

I get the code for the erc20 token and deploy it. It runs as expected. Then I create a front end for the coding. In the front end, I get the total supply, name, decimal output in the front end. I get the output for the transfer function in an erc20 in the command line, but it doesn’t work in the front end. I listed the code below. Can anyone help me?

motoko code:

Front end code:

It doesn’t work in the front end. But in the command line, it works.

val needs to be a number

I already put type Number=Nat; before the transfer function. I got the result in the command line but I don’t get the output in the front end. What mistake have I done?

Can you explain clearly? What I have to change?

.value from an input is going to be a string. You’ll need to pass



1 Like

I did what you said, but the output returns boolean false. It doesn’t transfer token

What I have to change?please explain

What I have to change?

Maybe return an error at the different parts in the code to figure out why it’s return false? Looks like from_balance is either null (ie no balance) or not enough. Remeber you are using the caller’s balance

That makes sense. to @stephenandrews point - the JavaScript agent makes calls as an AnonymousAgent by default. You’ll need an identity strategy for your frontend to manage who can have a balance

1 Like

I have balance transfer function is worked in command line

What I have to change ?Please help me

You need authentication client side so that the canister knows who is calling and what balance to transfer from.

In the client side ,How to get the information of caller information. Can you give ma a one example related to that

The most ready-made solution right now is internet identity. Here’s an example application I put together as a reference

1 Like

Thank you . I will check

How to install the dependencies for this project? I clone this project. Then what I have to do?

npm install
dfx start --clean --background
dfx deploy
npm start

Should get you up and running

I put npm install, then I put npm start, It shows you are not downloaded typescript, then I install typescript also I installed @dfinity/candid,@dfinity/identity,@dfinity/authentication
Then it shows an error like this:

ah yeah. You can create a file named .env and add


I should add these steps to the readme