I did not put in my code but only the repository. I have declared all variables and I thought that should work directly with the deploy. The problem still exists even if I call the init function again in the UI or via the terminal. The init function gives me the same error. Its working offline but not online.
If you want to call your canister that is deployed to the mainnet, use the following flag
dfx canister call --network ic token transfer "($OWNER, 10)"
Make sure you called initalize before as well. Calling initialize more then once is supposed to throw an error, so that’s expected. See the assert statement:
can you try the following, note that this will delete all state in your production canister!
dfx deploy --network ic --mode reinstall
dfx canister --network ic call token initialize '("test token", "tt", 0, 1000)'
// should return "test token"
dfx canister --network ic call token name
// should remove 10 tokens from the calling identity and add 10 to $OWNER
dfx canister --network ic call token transfer "($OWNER, 10)"
for your call to initalize i think you mixed up the position for the decimals and the total supply.
I don’t think you have to escape the double quotes with a backslash because you are using single quotes to encapsulate the argument, this should be the reason for the candid parser error you are seeing.
I have now deployed the token live. Now I wonder how I can add an image to the token? With the DIP-20 token it was easy with the parameters with base64 but here I don’t understand it. Do you know how I can implement this?
I’m not sure what you are trying to do, but the VSCode extension basically tells you what the problem is. You are for example trying to use TokenIdentifier, but there is no definition of what that is. You can either import the type from another module or redefine it.
Yes, you are right thank you! The only thing i cant solve is this error above (i edited the picture). I dont understand where i need to implement this.I declared this type.
Again the compiler is your friend and basically tells you that the nonce field you are referring to in the transfer.nonce does not exist in the type TransferRequest. And indeed, when you check the type definition you can see that it’s missing
You can either implement it yourself or open an issue in the repository. I haven’t checked it thoroughly but it looks like a bug that it’s missing.
I have implemented it now, thank you. Now I don’t have any errors in the code and I was able to deploy it locally. Unfortunately just not on the right network with --network ic
dfx deploy --network=ic --wallet="mpza4-jiowq-w3pxl-4qxoc-iy4lo-aq4o2-si3cl-nghcq-mmmyi-ftri6-3qe" --argument='("TOKEN", "$TOKEN", 2, 100000:nat, principal "principal id i removed for forum")' --with-cycles 1500000000000
Canister ID of my wallet
dfx identity --network ic get-wallet
hoysn-3aaaa-aaaan-qazqa-cai
Principal ID of my wallet
dfx identity --network ic get-principal
moztx-lv47l-qf53e-miy6s-pcp2k-6k5ya-xbsw2-mvxvy-vsmd6-k5kqj-cae
Status of my canister
Canister status call result for standard.
Status: Running
Controllers: moztx-lv47l-qf53e-miy6s-pcp2k-6k5ya-xbsw2-mvxvy-vsmd6-k5kqj-cae
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 2_592_000
Memory Size: Nat(8056313)
Balance: 2_025_410_846_708 Cycles
Module hash: 0xbb001d1ebff044ba43c060956859f614963d05c77bd778468fce4de095fe8f92
I tried out a lot and looked in the forum but nothing helped. What do I have to do to solve the error? If you need more informations let me know.
I looking at the controllers of the canister I think he should omit the wallet flag entirely as it looks like his idenity is already the sole controller of the canister.
dfx canister --network ic install --mode reinstall --argument='("TOKEN", "$TOKEN", 2, 100000:nat, principal "principal id i removed for forum")' standard