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

AuthorizationUsed event does not expose from, to, value #344

Open
danielnordh opened this issue Mar 17, 2022 · 2 comments
Open

AuthorizationUsed event does not expose from, to, value #344

danielnordh opened this issue Mar 17, 2022 · 2 comments

Comments

@danielnordh
Copy link

When monitoring Transfer and AuthorizationUsed (transferWithAuthorization) events, it is made more difficult by the latter not including/exposing the from, to and value parameters in the same way as the former.

Transfer:

"returnValues": {
    "0": "0xD9d3768621774c3C357b9B5fcB23B5735eA2c7aE",
    "1": "0x53574F64F817290e622842462cc2B8708c1a3808",
    "2": "80000",
    "from": "0xD9d3768621774c3C357b9B5fcB23B5735eA2c7aE",
    "to": "0x53574F64F817290e622842462cc2B8708c1a3808",
    "value": "80000"
}

AuthorizationUsed:

"returnValues": {
    "0": "0xD9d3768621774c3C357b9B5fcB23B5735eA2c7aE",
    "1": "0x1f05761787aabb9d5e1b89e4572163db5ddd76c2e18bd8ccd78d46e6e18bcf09",
    "authorizer": "0xD9d3768621774c3C357b9B5fcB23B5735eA2c7aE",
    "nonce": "0x1f05761787aabb9d5e1b89e4572163db5ddd76c2e18bd8ccd78d46e6e18bcf09",
}

How do I get the from, to and value parameters from an AuthorizationUsed event?

@danielnordh
Copy link
Author

danielnordh commented Mar 18, 2022

For now, my workaround is to get the transaction, decode the inputs with this package and getting the from, to, value from there. But it's a lot of extra work to get to parity of information.

var inputDataDecoder = require('ethereum-input-data-decoder');

let tx = await web3.eth.getTransaction(txHash);
let decoder = new inputDataDecoder(USDC_ABI);
let decodedData = decoder.decodeData(tx.input);

let from = decodedData.inputs[0];
let to = decodedData.inputs[1];
let value = decodedData.inputs[2].toString();

@MrHicks850
Copy link

#344 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@danielnordh @MrHicks850 and others