Use Chainlink Data Feed in Js file without hard coding Data feed Contract's ABI #2361
-
Hi |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
If you are worried about the explicitly hard-coded ABI, then you can put it in a If you think the above is too static, you can setup a conditional to account for which data feed's ABI (you can set up the various ones in a With the above approaches, you can avoid both the hard-coded and the static part of the problem you outlined. |
Beta Was this translation helpful? Give feedback.
-
@GarvitKarnwal Please use code instead of pictures so we can copy/paste to point out the issues. And let me know where did you get this ABI .json file path? Because the actual interface address is this import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; |
Beta Was this translation helpful? Give feedback.
-
I got one working code as shown below:
|
Beta Was this translation helpful? Give feedback.
I got one working code as shown below:
OUTPUT: