core
core copied to clipboard
[Feature] Add json path as const field of `sol!` generated mod
Component
sol! macro
Describe the feature you would like
Say we have the following macro invocation:
alloy::sol!(
#[sol(abi)]
UniswapV2Reader,
"src/abis/UniswapV2Reader.json"
);
There is no way to recover "src/abis/UniswapV2Reader.json" from UniswapV2Reader. It would be nice to be able to access the path to the json file that generated a given module.
Additional context
No response
Will do
@alexfertel can i take this up?
What is the motivation/use case for this issue?
What is the motivation/use case for this issue?
We generate the sol! snippets corresponding to the compiler output of our contracts automatically during build time (build.rs). The project uses the types that sol! outputs without ever knowing about the actual path to the json.
It would be nice to get access to the actual path through the type that sol! gives us at compile-time, so we can use $mod::ABI_PATH the same way we can use $mod::DEPLOYED_BYTECODE.