Open shazow opened 6 months ago
I had some code using AnyABI which I thought would easily slot in here. The problem is that AnyABI is missing a lot of the details that you're currently expecting from getContract. To add AnyABI, you would need to add the Optional ? to evmVersion
, compilerVersion
, and runs
export type ContractResult = {
abi: any[];
name: string | null;
evmVersion: string;
compilerVersion: string;
runs: number;
ok: boolean;
getSources?: () => Promise<ContractSources>;
loader?: ABILoader;
loaderResult?: EtherscanContractResult | SourcifyContractMetadata | any;
}
becomes
export type ContractResult = {
abi: any[];
name: string | null;
ok: boolean;
evmVersion?: string;
compilerVersion?: string;
runs?: number;
getSources?: () => Promise<ContractSources>;
loader?: ABILoader;
loaderResult?: EtherscanContractResult | SourcifyContractMetadata | any;
}
gut feel, is it worth it?
I'm down if you are. :) Could also add a AnyABIContractResult
for including the full result in loaderResult
.
Also looks like they mainly return the loadABI
equivalent which is fine. Makes sense for ContractResult
to basically be a superset if available, otherwise roughly equivalent.
I'm down to change the type as you mentioned.
https://anyabi.xyz/
It's redundant with etherscan and sourcify, but could make it race or a fallback?