Added getSources?: () => Promise<ContractSources>; to ContractResult
Currently only supported by the Etherscan loader
ContractSources automatically deserializes the encoded source code structure. This will help once we add support for the Sourcify loader which uses a different format (and will require a separate request for each import).
ContractResult is not yet accessible from AutoloadResult, so would need to use loaders directly to access it for now. (This will require a bit more plumbing, since autoload uses loadABI rather than loadContract, so we'll need yet another flag to include contract sources.)
Fixes #111
Usage:
const result = await loader.getContract(address);
const sources = await result.getSources();
for (const s of sources) {
console.log(s.path, " -> ", s.content.slice(25) + "...");
}
getSources?: () => Promise<ContractSources>;
toContractResult
ContractSources
automatically deserializes the encoded source code structure. This will help once we add support for the Sourcify loader which uses a different format (and will require a separate request for each import).ContractResult
is not yet accessible fromAutoloadResult
, so would need to use loaders directly to access it for now. (This will require a bit more plumbing, since autoload uses loadABI rather than loadContract, so we'll need yet another flag to include contract sources.)Usage: