Draft
Conversation
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.
Examples
@ledgerhq/hw-app-ethis driven by the call’s 4-byte selector. In@ledgerhq/evm-tools, ERC-20 and ERC-721 share the same selector forapprove()(0x095ea7b3). Passingnft: trueunconditionally enables NFT-related resolution for any call with that selector, so the device can receive NFT plugin data and show NFT allowance wording for ERC-20 contracts.nftflag from the serialized transaction instead of always passingnft: true. The helpershouldUseNftLedgerClearSignRLP-decodes the raw tx with@ethereumjs/tx’sTransactionFactory.fromSerializedData, reads the first four bytes of calldata, and returns true only for selectors we treat as NFT-only for Ledger resolution:setApprovalForAll(0xa22cb465), ERC-721 / ERC-1155safeTransferFromvariants (0x42842e0e,0xb88d4fde,0xf242432a), andsafeBatchTransferFrom(0x2eb2c2d6). For the sharedapprove(0x095ea7b3) andtransferFrom(0x23b872dd) selectors—and everything else—we usenft: false, so ERC-20 approves and transfers get ERC-20 clear-sign text while real NFT transfers and approvals still get NFT clear signing.LedgerSignTransactionParamsalso accepts an optionalnftoverride, forwarded through the iframe bridges, for callers that need to force the flag; the mobile bridge usesnft ?? shouldUseNftLedgerClearSign(tx)when the override is omitted.Technical Details