Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When dealing with cosmos based tokens, set fee denom and tx denom seperately #2607

Open
8ball030 opened this issue Aug 27, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@8ball030
Copy link
Contributor

8ball030 commented Aug 27, 2021

Is your feature request related to a problem? Please describe.
I am using fetch aea to tx mobix,

There is no way to set the denom of the fees seperately from the denom of the tx.

This requires some cerative tx manipulation to get the desired result.

Please see below;

aea config-override


public_id: fetchai/ledger:0.18.0
type: connection
config:
ledger_apis:
fetchai:
address: https://rest-andromeda.fetch.ai:443
denom: nanomobx
chain_id: andromeda-1
ethereum:
address: https://hidden-bold-glitter.matic.quiknode.pro/878802d4df1c01517caa777f1e82f23d806b3fb5/
gas_price_api_key: null

ledger_api_handler hack

def _handle_raw_transaction(
    self, ledger_api_msg: LedgerApiMessage, ledger_api_dialogue: LedgerApiDialogue
) -> None:
    """
    Handle a message of raw_transaction performative.

    :param ledger_api_message: the ledger api message
    :param ledger_api_dialogue: the ledger api dialogue
    """
    ledger_api_msg.raw_transaction.body['fee'] = {'amount': [{'amount': '1', 'denom': 'atestfet'}], 'gas': '80000'} # oh god why???
    self.context.logger.info("received raw transaction={}".format(ledger_api_msg))
    signing_dialogues = cast(SigningDialogues, self.context.signing_dialogues)
    signing_msg, signing_dialogue = signing_dialogues.create(
        counterparty=self.context.decision_maker_address,
        performative=SigningMessage.Performative.SIGN_TRANSACTION,
        raw_transaction=ledger_api_msg.raw_transaction,
        terms=ledger_api_dialogue.associated_fipa_dialogue.terms,
    )
    signing_dialogue = cast(SigningDialogue, signing_dialogue)
    signing_dialogue.associated_ledger_api_dialogue = ledger_api_dialogue
    self.context.decision_maker_message_queue.put_nowait(signing_msg)
    self.context.logger.info(
        "proposing the transaction to the decision maker. Waiting for confirmation ..."
    )

Describe the solution you'd like
Ideally, within the ledger api you would be able to specify the denom of the fee currency as well.

@DavidMinarsch
Copy link
Contributor

Ok so the issue is that the denom of the tx fee and the amount are not the same. This means we need to differentiate between the two in the kwargs here (https://github.com/fetchai/agents-aea/blob/develop/plugins/aea-ledger-cosmos/aea_ledger_cosmos/cosmos.py). Should be a simple fix :)

@DavidMinarsch DavidMinarsch added the bug Something isn't working label Aug 27, 2021
@8ball030 8ball030 changed the title When dealing with cosmos based tokens, set fee enom and tx denom seperately When dealing with cosmos based tokens, set fee denom and tx denom seperately Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants