Skip to content

Releases: shazow/whatsabi

v0.18.0

13 Dec 00:39
Compare
Choose a tag to compare

Summary

  • Minor breaking change: Backwards-compatible signature change of loaders.ContractResult, making more fields optional: evmVersion, compilerVersion, runs. This makes it so that we can express a simple loadABIresult as agetContract` result with missing fields.
  • Added EtherscanV2 and AnyABI loaders (not used by default yet).

What's Changed

Full Changelog: v0.17.0...v0.18.0

v0.17.0

21 Nov 17:09
Compare
Choose a tag to compare

Summary

  • Switched from ethers.js to Ox as our utility library (mainly for things like encoding/decoding ABIs).
    • Reduced the bundle size from 15.34kb ➡ 13.87kb (before new features below).
    • Big thanks to @jxom for the hands-on support.
  • Added Blockscout ABI loader.
    • Big thanks to @yohamta for doing this work!
// Make a MultiABILoader that includes BlockscoutABILoader
const abiLoader = new whatsabi.loaders.MultiABILoader([
  new whatsabi.loaders.SourcifyABILoader(),
  new whatsabi.loaders.EtherscanABILoader({
    apiKey: "...", // Replace the value with your Etherscan API key
  }),
  new whatsabi.loaders.BlockscoutABILoader({
    apiKey: "...", // Replace the value with your Blockscout API key
  }),
]);

{
  // Can use it separately
  const result = await loader.getContract("0x7a250d5630b4cf539739df2c5dacb4c659f2488d");
}

{
  // Or let autoload use it for us
  const result = whatsabi.autoload(address, { provider, abiLoader });
}

What's Changed

Full Changelog: v0.16.0...v0.17.0

v0.16.0

04 Nov 17:48
Compare
Choose a tag to compare

Summary

  • Improved whatsabi's disassembly so that it's more precise about where the runnable code section is. This helps reduce false positives, and improves finding proxy slots pulled in from the data section using CODECOPY.
  • Added AutoloadResult.isFactory when a CREATE or CREATE2 opcode is detected. This means that some of the results could be attributed to bytecode that is deployed by the factory, rather than the factory itself. That said, false positives like this should be further mitigated by the previous improvement!
  • Deduplicated experimental event results.

What's Changed

  • autoload: Add AutoloadResult.isFactory by @shazow in #144
  • disasm: Detect code boundary and look for slots in aux data by @shazow in #129
  • src/disasm.ts: Use Set for eventCandidates to avoid dupes by @shazow in #147

Full Changelog: v0.15.4...v0.16.0

v0.15.4

21 Oct 13:28
Compare
Choose a tag to compare

What's Changed

  • loaders: Avoid exception when Etherscan returns an empty response by @yohamta in #141
  • Handle multiple detected FixedProxyResolver better by @shazow in #143

Full Changelog: v0.15.3...v0.15.4

v0.15.3

10 Oct 22:44
Compare
Choose a tag to compare

What's Changed

  • disasm: Handle padded resolved address for FixedProxyResolver by @shazow in #140

Full Changelog: v0.15.2...v0.15.3

v0.15.2

03 Oct 13:10
Compare
Choose a tag to compare

What's Changed

  • src/auto.ts: check if contractResult.abi is not empty by @yohamta in #137
  • src/providers.ts: WithCachedCode, include prototype chain of Provider by @shazow in #138

Full Changelog: v0.15.1...v0.15.2

v0.15.1

02 Oct 15:17
Compare
Choose a tag to compare

What's Changed

  • providers: WithCachedCode should accept AnyProvider and make it compatible by @shazow in #134

Full Changelog: v0.15.0...v0.15.1

v0.15.0

01 Oct 18:36
Compare
Choose a tag to compare

Summary

whatsabi.providers.WithCachedCode

Added helper for caching getCode calls with autoload, useful for only resolving proxies when we already have the bytecode:

const address = "0x...";
const bytecode = "0x..."; // Already loaded from somewhere

const cachedCodeProvider = whatsabi.providers.WithCachedCode(provider, {
  [address]: bytecode,
});
const result = whatsabi.autoload(address, {
  provider: cachedCodeProvider,
  abiLoader: false, // Skip ABI loaders
  signatureLookup: false, // Skip looking up selector signatures
})

More docs here: https://shazow.github.io/whatsabi/modules/proxies.html

AutoloadResult.abiLoadedFrom

whatsabi.autoload will do everything necessary to load the ABI, which by default includes checking if it's already verified in public databases like Sourcify and Etherscan.

If the result is successfully loaded from an ABILoader, then it will be included in the AutoloadResult.abiLoadedFrom property. This is useful to distinguish if the result is from a verified database or whether WhatsABI had to resolve to doing its own internal static analysis to find selectors.

const result = whatsabi.autoload(address, config);
const loadedFrom = result.abiLoadedFrom?.name ?? "static analysis";
console.log("ABI loaded from:", loadedFrom);

More docs here: https://shazow.github.io/whatsabi/types/AutoloadResult.html

AutoloadResult.ContractResult

If we call whatsabi.autoload with setting { loadContractResult: true }, then we'll use the getContract loader APIs instead of loadABI which returns the full contract metadata (larger result and slower API call). The result will be included in the contractResult attribute, which also includes the full raw result in AutoloadResult.contractResult?.loaderResult.

const result = whatsabi.autoload(address, { provider, loadContractResult: true });
console.log(result.contractResult);

More docs here: https://shazow.github.io/whatsabi/types/loaders.ContractResult.html

What's Changed

  • src/loaders.ts: Add devdoc and userdoc support for SourcifyABILoader by @yohamta in #116
  • src/loader.ts: Add fallback for contract name in SourcifyABILoader by @yohamta in #121
  • loaders: Add AutoloadResult.abiLoadedFrom and plumb the result through MultiABILoader by @shazow in #122
  • Improve devex for only resolving proxies by @shazow in #120
  • loaders: Add loaderResult, remove {userdoc,devdoc} by @shazow in #127
  • loaders: Enhance ContractResult.loaderResult type by @yohamta in #128
  • autoload: AutoloadResult.ContractResult by @shazow in #131

New Contributors

Full Changelog: v0.14.1...v0.15.0

v0.14.1

12 Aug 15:01
Compare
Choose a tag to compare

Minor fix: Added exported whatsabi.errors types: https://shazow.github.io/whatsabi/modules/whatsabi.errors.html

Full Changelog: v0.14.0...v0.14.1

v0.14.0

09 Aug 20:27
7b28a95
Compare
Choose a tag to compare

Summary

What's Changed

New Contributors

Full Changelog: v0.13.2...v0.14.0