shazow / whatsabi

Extract the ABI (and resolve proxies, and get other metadata) from Ethereum bytecode, even without source code.
https://shazow.github.io/whatsabi/
MIT License
1.06k stars 74 forks source link

Feature request: Expose `provider.js` for Access to `CompatibleProvider` #124

Closed yohamta closed 1 month ago

yohamta commented 1 month ago

To implement functionality similar to auto.ts, it's necessary to invoke ProxyResolver.resolve and retrieve the implementation address.

Currently, the ProxyResolver interface is defined as follows:

https://github.com/shazow/whatsabi/blob/9d12cf97329ac99c063378a60ad7438cdf78ef52/src/proxies.ts#L47-L51

To work with the resolve function, we need to convert the provider to a CompatibleProvider type, as demonstrated in auto.ts: https://github.com/shazow/whatsabi/blob/9d12cf97329ac99c063378a60ad7438cdf78ef52/src/auto.ts#L119

However, CompatibleProvider from src/providers.ts is not currently exported as a module.

Proposed Change:

To address this, I propose exposing providers from the src/whatsabi.ts file by adding the following modification:

import * as loaders from "./loaders.js";
import * as proxies from "./proxies.js";
+ import * as providers from "./providers.js";
export { loaders };
export { proxies };
+ export { providers };

This change would allow access to CompatibleProvider and other utilities within providers.js.

Let me know if you'd like any further adjustments to this draft! If it is acceptable, I will be happy to open a pull request implementing the above change.

shazow commented 1 month ago

I believe this is already done in main: https://github.com/shazow/whatsabi/blob/main/src/whatsabi.ts#L26

Will be included in the next release.

(Please let me know if I made a mistake.)

yohamta commented 1 month ago

Oh my bad, thanks!