Using Hedera SDK JS, I can convert an Account ID to "long-zero" format EVM address.
e.g. 0.0.3996280
--> 0x00000000000000000000000000000000003cfa78
(See related question: "How to convert a Hedera native address into an EVM address?".)
How do I convert to the "non-long-zero" format EVM address?
e.g. 0.0.3996280
--> 0x7394111093687e9710b7a7aeba3ba0f417c54474
(See 0.0.3996280
on Hashscan.)
I need this because when you send ContractCallQuery
via Hedera SDKs, the value of msg.sender
as visible within any smart contract functions invoked is the "non-long-zero" format EVM address.
What I'm doing currently:
const operatorId = AccountId.fromString(process.env.OPERATOR_ID);
const operatorEvmAddress = operatorId.toSolidityAddress();
However, operatorEvmAddress
is in the "long-zero" format,
and I therefore cannot use that in my subsequent smart contract interactions.