Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
…hape-specific helpers
Adds `fromHumanReadable`, `fromJson`, `fromAbiName`, and `fromAbiSelector` to
`AbiItem`, `AbiFunction`, `AbiEvent`, and `AbiError` (constructors keep just
`fromAbi` since they have no name or selector). The original polymorphic
`from` and `fromAbi(abi, name | selector)` overloads are now `@internal`
dispatchers retained to back the shorthand decode/encode overloads.
`Abi.from` now defaults to `{ prepare: true }`, precomputing the signature
`hash` on every item; pass `{ prepare: false }` to opt out.
Amp-Thread-ID: https://ampcode.com/threads/T-019e1fbe-3a01-77f5-a169-12d4f2967861
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Splits the polymorphic
fromandfromAbi(abi, name | selector)helpers onAbiItem,AbiFunction,AbiEvent, andAbiErrorinto shape-specific functions:fromHumanReadable,fromJson,fromAbiName, andfromAbiSelector.The original polymorphic helpers are retained as
@internaldispatchers so the shorthanddecode/encodeoverloads keep working.AbiConstructorkeepsfromAbi(abi)since constructors have no name or selector.Abi.fromnow defaults to{ prepare: true }, precomputing the signaturehashon every item and removing the per-callkeccak256cost from the hot encode/decode path. Pass{ prepare: false }to opt out.Single-value collapse in
AbiFunction.decodeResultandAbiError.decode, and theundefinedreturn fromAbiConstructor.decodefor empty inputs, are unchanged.