0

I want to use forgeOperation and injectOperation function provided by '@taquito/rpc' to make a transfer between two tz1 accounts. I can estimate gasLimit, storageLimit and suggestedFee using '@taquito/taquito' estimate method. But to know whether we should include revelation fee or not to the suggestedFee, it is necessary to know the operations counter of a tz1 address. Which means:

if counter=0, then we should add revelation fee to suggested fee.
else, suggested fee is enough in order to operation get successful.

So, can anyone help me achieve the desired? Thanks in advance.

0

An unrevealed tz1 address doesn't necessarily have a counter of 0. To know if the address is revealed or not, you can use the getManagerKey method of the RpcClient class which will return "null" if the address is not revealed.

You also need to include the counter in the operation, it can be obtained using the getContract method of the RpcClient class.

1
  • Yes, I got the counter from getContract method of RpcClient class. we should increment the counter by 1 and add it to the operation object. Below is the code to get counter: const getContract = require('./rpc').getContract const result = await getContract(address); console.log((Number(result.counter) + 1).toString()); Dec 2 '21 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.