Releases: shazow/whatsabi
v0.15.4
v0.15.3
v0.15.2
v0.15.1
v0.15.0
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
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
Summary
- New and improved docs! https://shazow.github.io/whatsabi/
- Typed errors! Errors thrown by WhatsABI code will be wrapped in
WhatsABIError
and more fine-grained errors, to help with better error handling. - Improved viem support! Now handling any kind of viem client or transport (before we only worked with publicClient objects).
- Added source code loading of verified contracts to our loaders! Supporting both Etherscan and Sourcify.
What's Changed
- Add svvy.sh to readme by @roninjin10 in #97
- Add typed errors by @shazow in #100
- providers: Fix viem non-public clients, wrap autoload ENS error by @shazow in #107
- Add generated docs by @shazow in #108
- loaders: Add getSources() to ContractResult by @shazow in #112
New Contributors
- @roninjin10 made their first contribution in #97
Full Changelog: v0.13.2...v0.14.0
v0.13.2
v0.13.1
Summary
Improved provider support by relying on lower-level RPC methods whenever possible.
Fixed support for viem 2.x and web3.js
What's Changed
- switch viem and ethersv5 provider order by @Plopmenz in #94
- Improve provider abstraction: Use low level RPC whenever possible by @shazow in #95
- Added web3js to the test matrix
New Contributors
Full Changelog: v0.12.0...v0.13.1
v0.12.0
Summary
Added optional addressResolver
override for autoload:
const result = await whatsabi.autoload(address, {
provider: provider,
// ...
// Example: Use viem to resolve ENS addresses
addressResolver: async (name) => {
return await publicClient.getEnsAddress({ name })
},
}
Otherwise minor improvement to disassembling and the test suite.
What's Changed
- disasm: Detect inverted selector jump condition (with fallback) by @shazow in #85
- auto: Add addressResolver config by @shazow in #91
- src/tests/env.ts: Use public RPC by @shazow in #92
Full Changelog: v0.11.0...v0.12.0