How can I find the ABI of a smart contract which is not in ethereum blockchain, but only in my device, using Javascript?

Apr 6, 2022, 3:26 PM
Do you have the source solidity code?
Apr 6, 2022, 3:35 PM
Yes
Apr 6, 2022, 3:35 PM
Are you using truffle or hardhat or some other framework, no framework, or unsure?
Apr 6, 2022, 3:36 PM
No. I would like to calculate the gas price of smart contract which is not on ethereum blockchain.
To calculate it i need to create web3.eth.Contract(ABI,...)
So I'm searching a way to find the ABI of a contract using Javascript.
I find solc but i need to change the version of compiler because some contracts need older version... And from Javascript I Dont know how to change it
Apr 6, 2022, 3:40 PM
Yes, you will need to compile the contract with --abi flag.
Apr 6, 2022, 3:41 PM
Ye but I must do this operation directly in Javascript. And I know how to do that... But before I need to change compiler version... 😱
Apr 6, 2022, 3:42 PM
Are you saying you need to compile from within javascript? If that's the case, then you need solcjs.
Apr 6, 2022, 3:44 PM
Ye sorry. When I wrote solc I mean solcjs
github.com/ethereum/solc-js
I'm using this, but as I said before I don't know a way to change the version of the compiler from js
Apr 6, 2022, 3:46 PM
I believe, if you're code is not dependent on some legacy version of solc, you should not need to specify a version. If you're getting an error when attempting to compile, what is the error?
But there is... solc.loadRemoteVersion
Apr 6, 2022, 4:20 PM

© 2024 Draquery.com All rights reserved.